JAVA CHARACTER SET
Java uses the Unicode character set. Unicode is a two-byte character code set that has characters representing almost all human alphabets and writing systems.
Tokens : The smallest unit of java is called tokens. Java has the following tokens :
1. Keywords : Keywords are the words that convey a special meaning to the language compiler. These are reserve for special purpose and must not be used as normal identifier names. eg if, for
2. Identifiers: Identifiers are fundamental building blocks of a program and are used as the general terminology for the names given to the different parts of the program viz. variable, objects, class .
3. Literals are data items that are fixed data values. Java allows several kinds of literals:
i) Integer Literal : Integer literals are whole numbers without any fractional part
Java allows three types of integers literals :
Decimal (base 10) : starts with a digit other than 0 e.g. 24
Octal ( base 8) : start with a digit O but can’t contain digits 8,9 e.g. 030.
Hexadecimal (base 16) : starts with Ox and can’t contain letters G-Z e.g. 0x18.
ii) Floating Literals : Floating Literals are also called real Literals. Real literals are numbers having fractional parts or exponent form.
Fractional form consists of signed or unsigned digits including a decimal point between digits.
Exponent Form : consists of two parts : mantissa and exponent. For instance 5.8 written as 0.58 * 10¹ = 0.58e01 where 0.58 is mantissa and E01 is exponent part.
iii) Boolean Literals : It has two vales : true and false.
iv) Character Literals : It is a single character enclosed in single quote e. g. ‘e’
v) String Literals : Multiple characters in double quotes.
vi) NULL Literals :Null has one value, the null reference , represented by the literal null
4. Separators : the following nine ASCII characters are the separators ( punctuators ) . e.g. {},(),[],;
5. Operators : Operators are the symbols that initiate an action. There 37 tokens are the operators formed from the ASCII characters: e.g.=,<,!=, >>= .
6. Data Types : Java data types are of two types:
(i) Primitive : that are inbuilt data type . e.g. byte, short, int, long, float, double, char, Boolean.
(ii) Reference: data types are constructed from primitive data types. These are : classes , arrays and interface.
7. Class as a composite data type that is based on fundamental datatype. A class contain different data members using fundamental data type and using object of that class we can take as a single value.
Difference Between Primitive and User defined Data type
- Primitive Data types : These are inbuilt and having fixed sizes. Primitive data type available in all part of program.
- User Defined data type : It is created by the user with the help of primitive type. The size of these datatype are variables .The availability of these datatype depends upon their scope .
Scanner class : It is in java.util package , which allows the user to read values of various types using scanner object;
e.g.
Scanner sc = new Scanner ( System.in); nextint(), next(), nextLine(), nextDouble(), nextFloat() are used with Scanner object.
Wrapper Class : Wrapper classes are the part of java.lang and these convert primitive datatypes in an object. A wrapper class wraps primitive type in an object. e.g. Boolean, Integer, Double, Short, Long, Characters.

1 Comments
Thanks..😀😀
ReplyDelete