{"id":65838,"date":"2021-07-16T04:10:04","date_gmt":"2021-07-16T08:10:04","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/scjp-class-declarations-java-short-notes-scjp\/"},"modified":"2022-05-10T20:04:09","modified_gmt":"2022-05-11T00:04:09","slug":"scjp-class-declarations-java-short-notes-scjp","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=65838","title":{"rendered":"SCJP: Class Declarations #Java Short Notes #SCJP"},"content":{"rendered":"<p><b>class declarations<\/b> <\/p>\n<ul>\n<li> Start with modifiers such as public, private followed         by class keyword   <\/li>\n<li> The class name, with the initial letter capitalized    <\/li>\n<li> The name of the class&#8217;s parent (superclass),          preceded by the keyword extends (if any). A class can         only extend (subclass) one parent.    <\/li>\n<li> list of interfaces implemented by the class,           preceded by the keyword implements (if any). A class          can implement more than one interface     <\/li>\n<li> The class body, surrounded by braces, {}.     <\/li>\n<li> Class member variable declarations\n<ul>\n<li> Requires three components, in order:             <\/li>\n<li> Zero or more modifiers, such as public or                   private             <\/li>\n<li> The field&#8217;s type             <\/li>\n<li> The field&#8217;s name.     <\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><b>Abstract Classes<\/b><\/p>\n<ul>\n<li> A class declared with abstract keyword is an abstract       class. It may or may not include abstract methods <\/li>\n<li> Abstract classes cannot be instantiated <\/li>\n<li> Abstract classes can be subclassed <\/li>\n<li> Class containing abstract methods, must be declared to      be abstract  <\/li>\n<li> Abstract methods are methods declared without       implementation (braces) <\/li>\n<li> The subclass of an abstract class must provide       implementations of all the abstract methods otherwise       the subclass itself needs to be declared as abstract. <\/li>\n<li> An abstract class may have static and final fields and       methods. Interfaces can not <\/li>\n<li> If an abstract class contains only abstract method       declarations with no implementations, it should better      be declared as an interface  <\/li>\n<li> It&#8217;s a good design to declare a common abstract class with common methods with implementations for several very related classes (will extend the abstract class) <\/li>\n<li> An abstract class can implement an interface but are      not bound to implement all interface methods  <\/li>\n<\/ul>\n<p><b>Nested Classes<\/b><\/p>\n<ul>\n<li> Classes declared under another class are called nested       classes <\/li>\n<li> Two types: Static Nested: declared with static keyword, Inner Nested: declared with no static keyword <\/li>\n<li> inner classes have access to other members of the       outer class including private members <\/li>\n<li> Static nested classes do not have access to other       members of the outer class  <\/li>\n<li> Static nested classes are accessed using the outer       class name such as: OuterClass.StaticNestedClass <\/li>\n<li> To use inner classes, the outer class must be instantiated first. Then, inner object can be created as follows: OuterClass.InnerClass innerObject = outerObject.new InnerClass(); <\/li>\n<li> Local inner classes: Declared within the body of a       method <\/li>\n<li> Anonymous inner classes: Declared within the body of       a method without naming it <\/li>\n<li> Inner classes may have similar access modifiers like       other outer class members <\/li>\n<li> Why use nested classes:\n<ul>\n<li> For logically grouping classes that are only                used in one place           <\/li>\n<li> It increases encapsulation.           <\/li>\n<li> May lead to more readable and maintainable                 code      <\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p> From: http:\/\/sitestree.com\/?p=4866<br \/> Categories:Java Short Notes, SCJP<br \/>Tags:<br \/> Post Data:2012-09-13 21:25:27<\/p>\n<p>\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\t(Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"> http:\/\/Training.SitesTree.com<\/a><br \/>\n\t\tIn Bengali: <a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\">http:\/\/Bangla.SaLearningSchool.com<\/a><br \/>\n\t\t<a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\">http:\/\/SitesTree.com<\/a><br \/>\n\t\t8112223 Canada Inc.\/JustEtc: <a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\">http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine Learning) <\/a><br \/>\n\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com'> https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\tMedium: <a href='https:\/\/medium.com\/@SayedAhmedCanada' target='new' rel=\"noopener\"> https:\/\/medium.com\/@SayedAhmedCanada <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>class declarations Start with modifiers such as public, private followed by class keyword The class name, with the initial letter capitalized The name of the class&#8217;s parent (superclass), preceded by the keyword extends (if any). A class can only extend (subclass) one parent. list of interfaces implemented by the class, preceded by the keyword implements &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=65838\">Continue reading<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1917,1954],"tags":[],"class_list":["post-65838","post","type-post","status-publish","format-standard","hentry","category-fromsitestree-com","category-scjp-ocjp","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":65860,"url":"http:\/\/bangla.sitestree.com\/?p=65860","url_meta":{"origin":65838,"position":0},"title":"SCJP Training: Lesson 1: Develop code that declares classes (including abstract and all forms of nested classes), interfaces, and enums, and includes the appropriate use of package and import statements (including static imports). #Java Short Notes #SCJP","author":"Sayed","date":"July 16, 2021","format":false,"excerpt":"Declaring ClassesAbstract Methods and ClassesNested ClassesInterfacesEnum TypesCreating and Using Packages Using Package Members (import statements, static imports)Defining an InterfaceImplementing an InterfaceAbstract Methods and ClassesPrimitive Data TypesArraysEnum TypesUnderstanding Instance and Class MembersVariables Declaring Member VariablesUnderstanding Instance and Class MembersPassing Information to a Method or ConstructorOverriding and Hiding MethodsDefining Methods (overloading)Returning a\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":65842,"url":"http:\/\/bangla.sitestree.com\/?p=65842","url_meta":{"origin":65838,"position":1},"title":"SCJP: Random Stuffs #Java Short Notes #SCJP","author":"Sayed","date":"July 16, 2021","format":false,"excerpt":"An enum may NOT be declared in a method An enum can be imported If the JVM has a choice, it will select a method without varargs before selecting a method with varargs When enums are equal, both .equals and == always return true The headMap() method returns the portion\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":65822,"url":"http:\/\/bangla.sitestree.com\/?p=65822","url_meta":{"origin":65838,"position":2},"title":"SCJP: Language Fundamentals #Java Short Notes #SCJP","author":"Sayed","date":"July 15, 2021","format":false,"excerpt":"Class declaration and java source file. Only \"one\" top-level public class is allowed per java source file. The name of the java source file and the name of the top-level public class MUST be the same. If no public class is there in a file, after compiling separate class files\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":22132,"url":"http:\/\/bangla.sitestree.com\/?p=22132","url_meta":{"origin":65838,"position":3},"title":"SCJP: Sun Certified Java Programmer: All that you need to know #SCJP","author":"Sayed","date":"March 10, 2021","format":false,"excerpt":"Introduction to Sun Certified Java Programmer Certification CourseJava : SCJP: Important ResourcesJAVA: Some links: useful for exams like scjp\/scjaSCJP Essential KnowledgeSCJP Practice ExamsSCJP Training: Lesson 1: Develop code that declares classes (including abstract and all forms of nested classes), interfaces, and enums, and includes the appropriate use of package and\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":22130,"url":"http:\/\/bangla.sitestree.com\/?p=22130","url_meta":{"origin":65838,"position":4},"title":"SCJP: Topics and Resources : will be continued #SCJP","author":"Sayed","date":"March 10, 2021","format":false,"excerpt":"SCJP topics and related resources are provided. I have skimed through the resources at least one time.Garbage Collection Test area:Given a code example, recognize the point at which an object becomes eligible for garbage collection, determine what is and is not guaranteed by the garbage collection system, and recognize the\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":74773,"url":"http:\/\/bangla.sitestree.com\/?p=74773","url_meta":{"origin":65838,"position":5},"title":"Are you interested in becoming a Java Developer and OCJP","author":"Sayed","date":"May 31, 2022","format":false,"excerpt":"Are you interested in becoming a Java Developer and OCJP? OCJP: Oracle Certified Java Programmer? Are you interested in a Java based career track? Short Notes on: OCJP: Oracle Certified Java Programmer Certification. Written long back in the SCJP time. These are for quick review purposes, not really to learn\u2026","rel":"","context":"In &quot;\u09ac\u09cd\u09b2\u0997 \u0964 Blog&quot;","block_context":{"text":"\u09ac\u09cd\u09b2\u0997 \u0964 Blog","link":"http:\/\/bangla.sitestree.com\/?cat=182"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65838","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=65838"}],"version-history":[{"count":2,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65838\/revisions"}],"predecessor-version":[{"id":74742,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65838\/revisions\/74742"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=65838"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=65838"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=65838"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}