Java Keywords
- Keywords are simple English words which are having predefined meaning in Java Programming Language.
- Meaning of these keywords can't be modified.
- Keywords are also called Reserved Words.
- All the keywords are defined in lower case.
- We can't use keywords as names of variables, methods, classes or as any other identifiers.
- true, false, null are not keywords but reserved as Literals.
- There are 49 keywords defined up to Java 2.
- enum is new keyword add from Java 5 so there are 50 keywords from Java 5.
- const and goto are keywords but no implementation available. You can't use these keywords in Java program.
List of Keywords
|
|||||||||||||
Data types (8)
|
|
||||||||||||
Class & Object (9)
|
|
||||||||||||
Access Modifier (3)
|
|
||||||||||||
Modifier (9)
|
|
||||||||||||
Package (2)
|
|
||||||||||||
Control Statements (12)
|
|
||||||||||||
Exception Handling (6)
|
|
||||||||||||
Other type (1)
|
void
|
Identifiers
- Identifiers are the names which will be used to identify the programming elements like variable, methods, classes etc uniquely.
- Identifiers are also known as User Defined Words.
Rules to follow when we define an identifier:
- Identifier can contain Alphabets, Digits and two special symbols Dollar ($) and Underscore (_).
- First character of an identifier must be an Alphabet or Dollar ($) or Underscore (_).
- Keywords or Reserved words can't be used as Identifier.
Valid Identifier
|
Invalid Identifier
|
Hello
|
1stClass
|
Int
|
true
|
getClassName
|
student number
|
studentEmail
|
student-email
|
TOTAL_FEE
|
int
|
Other Core Java Articles:
1. Java Characteristics / features / buzzwords
2. Java basic questions
3. Java history / java editions / java versions
1. Java Characteristics / features / buzzwords
2. Java basic questions
3. Java history / java editions / java versions
No comments:
Post a Comment