Java Non-Access Modifiers #1

Part Of Java Non-Access Modifiers

Java Non-Access Modifiers ~ Read the article in addition about Modifier Types before this (optionable).

Coding Java Non-Access Modifiers
Java Coding

The Non-Access Modifiers (Static)

Static Variables
Java Non-Access Modifiers static  keyword is consequently used to create variables that only exist independently of any other instances created for the class.
Static Methods
Therefore Static methods create methods that are independent without any other instances.
example :
static void is Blue (Color color)
{
….
}

The Java Non-Access Modifiers (Final)

 
Final Variables 
For this variables, you could explicitly only initialize it once. A reference variable could never be reassigned when it’s declared final.
A constant class variable is created with a static keyword which is consequently created by final modifiers using variables.
Final Methods
Subclassses also can never be override a final method. As I mention earlier , the final modifier prevents a method from any kind of modification in a subclass.
 
example :
 
public class FinalMethodExmpl {
   public final void changeName() {
      // body of method
   }
}
Final Classes
Well, you’re probably wondering why declaring a class as final is so important, therefore turning into subclasses are imposible. If you declare a class as final, in conclusion no class in the world can inherit any feature from the final class.

Leave a Reply

Your email address will not be published. Required fields are marked *