You are on page 1of 4

LANGUAE FUNDAMENTALS

TOPICS:
1. IDENTIFIERS
2. RESERVED WORDS
3. DATA TYPES
4. LITERALS
5. ARRAYS
6. TYPE OF VARIABLES
7. VAR-ARG METHODS
8. MAIN METHOD
9. COMMAND LINE ARGUMENTS
10. JAVA CODING STANDARDS
1. IDENTIFIERS:
A name in java program is called identifier which can be used for
identification purpose.it can be method name, variable name, class name
or label name.
Example:
Class Test
{
Public static void main(String[] args)
{
Int x=10;
}
}
Identifiers in above examples: Test (class
name),main(method),String(method),args,x

Rules for defining java identifiers:


1. The only allowed characters in java identifiers is a-z, A-Z, 0-9, $, _.if
other used you will get compile time error.
Ex: totalnumber(valid), total#(not valid)
2. Identifiers should or cant not start with digits.
Ex: total123,12total(not valid)
3. Java identifiers are case sensitive of course java language itself
treated as case sensitive programing language.
Ex:
Class Test{
Int number=10;
Int Number=18;
Int NUMBER=30;

}
4. There is no length limit for java identifiers but it is not
recommended to take too lengthy identifiers. (Good as much as
small to appear).
5. We cant use reserved words as identifiers.
Ex: int c=10;(valid) int if=10(not valid);int String=888;(valid).
6. All predefined java class ,interphase name we can use as identifiers
Ex(valid): Class Test{
Int String =88;
System.out.println(Striong);
}
Even though it is valid it is not a good programming practice
because readability and creates confusion.
Faqs:
Q.Which of the fallowing are valid identifiers:
Total_number(v),total#(n.v),12total(n.v),$h(v),ca$h(v),_$_$_$_$
(v),all@srinu(n.v),java2Share(v),Integer(v),Int(v),int(n.v)
2. RESERVED WORDS
In java to represent some meaning and functionality such type of
words called reserved words.
Reserved Words (53)
Keyword (50)
Used key words(48)
(If, else..)

Reserved Literals (3)


(true,false,null)

Unused key words (2)


(goto ,const)

Keywords for datatypes: (8) byte, short, int, long, float, double, Boolean,
char.
Keywords for flow control :( 11) if, else, switch, case, default, while, do,
for, break, continue, return
Keyword for modifiers: (11) public, private, protected, static, final,
abstract, synchronised, native, strictfp(1.2v), transient, volatile
Keyword for exception handling: (11)fry, catch, finally, throw, throws,
assert(1.4)
Class related keywords: (6) class, interface, extract, implement, package,
import
Object implemented keywords: (4) new, instanceof, super, this

Void return type keyword: (1) voidin java returned type is mandatory, if
method wont return anything then we have to return type is void.
But in c language is optional and default return type is void
Unused keywords: (2)
Goto: usage of goto created several problems in old languages and
hence sun people banned this keyword in java.
Const: use of final instead of const
Note: goto and const are unused keywords and if we are trying to
use we will get compile time errors.
Used for reserved literals: (3) true, falsevalues for Boolean data type,
nullfor object reference.
Enum (1.5v): we can use enum to define a group of named constants.
Ex: enum month{jan,feb,sec;},enum bear{kf,ko,rc,fo}
Conclusions:
a. All 53 reserved words in java contains only lower case alphabet
symbols.
b. In java we have only new keyword and there is no delete keyword
because distraction of useful objects is the responsibility of garbage
collections.
c. The fallowing are new keywords in java:
strictfp1.2v
assert1.4v
enum1.5v
d. strictfp but not strictFp
instanceof but not instanceOf
synchronized but not synchronize
extends but not extend
implements but not implement
import but not imports
const but not constant
Questions:
a. which of the fallowing list contains only java reserved words
new, delete(not in java)
goto, constant
break, continue, return, exit(not reserved)
final, finally, finalize
throw, throws, thrown
notify, notifyAll
implements, extends, imports
sizeof(not there), instanceof,
instanceof,stristFp

byte,short,Int
None of the above (right)
b. Which of the are java reserved words?
pubic,static,voidreserved
main,string,argsmethod,class,varible

You might also like