{"id":1096,"date":"2022-02-07T18:56:11","date_gmt":"2022-02-07T18:56:11","guid":{"rendered":"https:\/\/mdr.foobrdigital.com\/?p=1096"},"modified":"2022-02-07T18:56:11","modified_gmt":"2022-02-07T18:56:11","slug":"modifier-types","status":"publish","type":"post","link":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/2022\/02\/07\/modifier-types\/","title":{"rendered":"Modifier Types"},"content":{"rendered":"\n<p>Modifiers are keywords that you add to those definitions to change their meanings. Java language has a wide variety of modifiers, including the following \u2212<\/p>\n\n\n\n<ul><li>Java Access Modifiers<\/li><li>Non Access Modifiers<\/li><\/ul>\n\n\n\n<p>To use a modifier, you include its keyword in the definition of a class, method, or variable. The modifier precedes the rest of the statement, as in the following example.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example\">Example<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code><em>public<\/em> class className {\n   \/\/ ...\n}\n\n<em>private<\/em> boolean myFlag;\n<em>static final<\/em> double weeks = 9.5;\n<em>protected static final<\/em> int BOXWIDTH = 42;\n\n<em>public static<\/em> void main(String&#91;] arguments) {\n   \/\/ body of method\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"access-control-modifiers\">Access Control Modifiers<\/h2>\n\n\n\n<p>Java provides a number of access modifiers to set access levels for classes, variables, methods and constructors. The four access levels are \u2212<\/p>\n\n\n\n<ul><li>Visible to the package, the default. No modifiers are needed.<\/li><li>Visible to the class only (private).<\/li><li>Visible to the world (public).<\/li><li>Visible to the package and all subclasses (protected).<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"non-access-modifiers\">Non-Access Modifiers<\/h2>\n\n\n\n<p>Java provides a number of non-access modifiers to achieve many other functionality.<\/p>\n\n\n\n<ul><li>The&nbsp;<em>static<\/em>&nbsp;modifier for creating class methods and variables.<\/li><li>The&nbsp;<em>final<\/em>&nbsp;modifier for finalizing the implementations of classes, methods, and variables.<\/li><li>The&nbsp;<em>abstract<\/em>&nbsp;modifier for creating abstract classes and methods.<\/li><li>The&nbsp;<em>synchronized<\/em>&nbsp;and&nbsp;<em>volatile<\/em>&nbsp;modifiers, which are used for threads.<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Modifiers are keywords that you add to those definitions to change their meanings. Java language has a wide variety of modifiers, including the following \u2212 Java Access Modifiers Non Access Modifiers To use a modifier, you include its keyword in the definition of a class, method, or variable. The modifier precedes the rest of the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[238],"tags":[],"_links":{"self":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/1096"}],"collection":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/comments?post=1096"}],"version-history":[{"count":0,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/1096\/revisions"}],"wp:attachment":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/media?parent=1096"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/categories?post=1096"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/tags?post=1096"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}