{"id":65965,"date":"2021-07-18T10:54:06","date_gmt":"2021-07-18T14:54:06","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/java-rules-java-short-notes\/"},"modified":"2021-07-18T10:54:06","modified_gmt":"2021-07-18T14:54:06","slug":"java-rules-java-short-notes","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=65965","title":{"rendered":"Java Rules #Java Short Notes"},"content":{"rendered":"<ul>\n<li> Do not synchronize an instance variable or a code block without an object &#8211; it is illegal in Java    <\/li>\n<li> a synchronized context: wait(), notifyAll() &#8211; may be required to be called     <\/li>\n<li> Do not add a checked exception to an overridden          method   <\/li>\n<li> A superclass does not have to be serializable, but its constructor will run when a serializable subclass instance is deserialized.<\/li>\n<li> \tLoose coupling: you can change the implementation of a class without affecting the other classes. For example, if two classes say A and B &#8211; do not use each other at all (no instantiation of the other or no method calling ), they are not coupled. If A uses B but B does not use A, then they are loosely coupled. If both A and B use each other, then they are tightly coupled.Loose coupling expects that a class should keep its members private and that the other class should access themthrough getters and setters  <\/li>\n<\/ul>\n<p> From: http:\/\/sitestree.com\/?p=4910<br \/> Categories:Java Short Notes<br \/>Tags:<br \/> Post Data:2010-02-08 12:34:16<\/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>Do not synchronize an instance variable or a code block without an object &#8211; it is illegal in Java a synchronized context: wait(), notifyAll() &#8211; may be required to be called Do not add a checked exception to an overridden method A superclass does not have to be serializable, but its constructor will run when &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=65965\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1917],"tags":[],"class_list":["post-65965","post","type-post","status-publish","format-standard","hentry","category-fromsitestree-com","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":65850,"url":"http:\/\/bangla.sitestree.com\/?p=65850","url_meta":{"origin":65965,"position":0},"title":"SCJP: Rules #Java Short Notes #SCJP","author":"Sayed","date":"July 16, 2021","format":false,"excerpt":"A class's superclasses don't have to implement Serializable in order to be serialized if a superclass doesn't implement Serializable then it's constructor will run during deserialization A transient variable's state is lost during serialization, but a volatile variable's state is not lost Java:Volatile variable Transient Variable NumberFormat, Calendar, DateFormat are\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":65852,"url":"http:\/\/bangla.sitestree.com\/?p=65852","url_meta":{"origin":65965,"position":1},"title":"SCJP: Short Notes #Java Short Notes #SCJP","author":"Sayed","date":"July 16, 2021","format":false,"excerpt":"For the package package com.sun2;public enum Seasons {SUMMER, FALL, WINTER, SPRING} Valid import statements are:import com.sun2.Seasons; \/\/ the class import static com.sun2.Seasons.*; \/\/all enum valuesimport static com.sun2.Seasons.FALL; \/\/only one enum value An interface can extend many interfacesInterfaces can have variables, overrides and overloads An enum can have methods and can\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":65965,"position":2},"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":78425,"url":"http:\/\/bangla.sitestree.com\/?p=78425","url_meta":{"origin":65965,"position":3},"title":"Factory Design Pattern: Examples in Java","author":"Sayed","date":"August 28, 2025","format":false,"excerpt":"Observe the code below: ShapeFactory factory = new ShapeFactory(); Shape shape1 = factory.getShape(\"circle\"); Shape shape2 = factory.getShape(\"square\"); Shape shape3 = factory.getShape(\"rectangle\"); shape1.draw(); shape2.draw(); shape3.draw(); We wanted to create objects such as shape1, shape2, and shape 3. We did not directly (create and) call the class for the required objects. We\u2026","rel":"","context":"In &quot;Java Design Patterns and OOP&quot;","block_context":{"text":"Java Design Patterns and OOP","link":"http:\/\/bangla.sitestree.com\/?cat=1962"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":78427,"url":"http:\/\/bangla.sitestree.com\/?p=78427","url_meta":{"origin":65965,"position":4},"title":"Builder Pattern vs \u2699\ufe0f Factory Pattern in Java","author":"Sayed","date":"August 28, 2025","format":false,"excerpt":"From AI Tools\/Open AI\/ChatGPT \" Perfect \ud83d\udc4d Here\u2019s a copyright-free comparison table of the Builder Pattern vs Factory Pattern in Java, styled for easy posting on Facebook\/Blog: \ud83c\udfd7\ufe0f Builder Pattern vs \u2699\ufe0f Factory Pattern in Java AspectBuilder PatternFactory PatternTypeCreational design patternCreational design patternPurposeTo construct complex objects step by step with\u2026","rel":"","context":"In &quot;Java Design Patterns and OOP&quot;","block_context":{"text":"Java Design Patterns and OOP","link":"http:\/\/bangla.sitestree.com\/?cat=1962"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/08\/image-27.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/08\/image-27.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/08\/image-27.png?resize=525%2C300 1.5x, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/08\/image-27.png?resize=700%2C400 2x"},"classes":[]},{"id":26745,"url":"http:\/\/bangla.sitestree.com\/?p=26745","url_meta":{"origin":65965,"position":5},"title":"RMI Example &#8211; Message, illustrates retrieving a message from an object located on a remote server. Requires the following classes: #Programming Code Examples #Java\/J2EE\/J2ME #Network Programming","author":"Author-Check- Article-or-Video","date":"April 30, 2021","format":false,"excerpt":"RMI Example - Message, illustrates retrieving a message from an object located on a remote server. Requires the following classes: Rem.java Establishes which methods the client can access in the remote object. import java.rmi.*; \/** The RMI client will use this interface directly. The RMI * server will make 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":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65965","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\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=65965"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65965\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=65965"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=65965"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=65965"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}