Professional Documents
Culture Documents
Character Set DataType Keywords
Character Set DataType Keywords
Constants
Constants is a variable which does not change the value once it has
been assigned called constants. There is no any in built constants in java.
If you want to make variable as constants then must use keyword final
(we will teach you final keyword in next section).
In java, based on the data type of a variable, operating system allocates the
memory and decides what can be stored in the reserved memory.
There are eight primitive data types we have in java. These are already
defined and named by a keyword.
byte :
short :
int :
long :
float :
double :
boolean :
char :
Example
Non primitive data types are also known as reference data types.
Primitive Non-Primitive
Primitive data types are keywords. Non-Primitive are classes,
interfaces.
Memory size is fixed. Memory size is not fixed.
It starts with lower case letters. It always starts with capital letters.
Keywords
Keywords are predefined words.
void : used with method to create a method which doesn’t return anything.
continue : it is used to skip the current iteration of the loop and jump to
next iteration.
Interview Questions :
1. Tell me some java keywords you frequently use.
2. Which keyword is used to create an object?
3. What is void keyword?
4. What is null? Does it mean empty?
5. Which keyword is used to create a class?
6. Which keyword is used to make a variable as constant?