Basic JAVA 3
Identifiers in Java
All Java components require names. Name used for classes, methods, interfaces and variables are called Identifier. Identifier must follow some rules. Here are the rules.
A Java keyword cannot be used as an identifier.
All identifiers must start with either a letter( a to z or A to Z ) or currency character($) or an underscore(_).
After the first character, an identifier can have any combination of characters.
Identifiers in Java are case sensitive.
Java Modifiers
Like other languages, it is possible to modify classes, methods, etc., by using modifiers. There are two categories of modifiers:
1) Access Modifiers
default, public, protected, private.
Visible to the package, the default. No modifiers are needed.
Visible to the class only (private).
Visible to the world (public).
Visible to the package and all subclasses (protected).
2) Non-access Modifiers :
static, final, abstract, strictfp, etc.
The static modifier for creating class methods and variables.
The final modifier for finalizing the implementations of classes, methods, and variables.
The abstract modifier for creating abstract classes and methods.
The synchronized and volatile modifiers, which are used for threads.
No comments:
Post a Comment
Hai , Post your comment . (required, Bugs, Errors )