In this article, what are Fundamentals of Java|Java tokens? is explained in detail. Tokens are different entities (individual units), using which we write java programs.These Fundamentals of Java|Java tokens. Java tokens are classified as follows.
Keywords are special words or reserved words,which have special meaning and usage in a java program. Java supports 48 standard keywords,2 unused keywords and 3 literals.
(In total 53 keywords are supported in java).
Unused keywords are goto,const. (From the topic Fundamentals of Java|Java tokens?)
Literals are true,false,null.
48 standard keywords are.
Identifiers
Identifiers are entities,which are used to identify something uniquely in a program such as
- Class-name.
- Method-names.
- Data-member names.
- Variable Names.
>They should start with alphabets or with $ symbol
>No space and no special characters should be present in between. However underscore "_" is allowed.
Ex: Phone_number.
First_number.
>We can use digits at the last .
Ex: Subject1.
Subject2.
>Keywords cannot be used as identifiers (From the topic Fundamentals of Java|Java tokens?)
>Length of identifier can be 0 to 255 characters
Ex: Permanent_address(17 characters)
>No two identifiers should be duplicated.
Ex: int x,y;
float x,y;
by giving same variables for both data types leads to duplicating instead of using x,y use other variables like a,b.(i.e float a,b;)
Constants (Literals)
Constants are fixed values of a particular type of data,which cannot be modified in a program. Technically they are known as literals.Java supports the following constants.
- Integers.
- Floating/Real numbers.
- Boolean.
- characters.
- String constant.
Integers: It supports three types of integers constants,they are (Decimal)10 (0-9), (Octal)8 (0-7), (Hexadecimal)16 (0-9,a,b,c,d,e,f).
Floating/Real Numbers: They are of two types (From the topic Fundamentals of Java|Java tokens?)
Standard
Ex:3.1456
Scientific
Ex:3.14E+38
Boolean: They are two "True/False".
Characters: It is a single character which is represented in single quotations.
Ex:'A','\n','o' etc...
String constant: It is a collection of characters represented in double quotations.
Ex:"hello","Welcome".
Note: In Java,we use "String" class to represent collection of characters.
Operators
Operators are special symbols,which are used to perform mathematical operations on values.
Ex: +,-,*,/,%,<,>,&,||,<<>>,etc..
Special Symbols
They are nothing but special characters only,with special usage and specific utility in a program.
Ex: . ; { } < > " ' [ ] etc..
Separators
These are used to separate some thing in a program based on situation.
Ex: . , ; { } space ( ) [ ] etc... (From the topic Fundamentals of Java|Java tokens?)
Do check my new startup Surprise Planners in Hyderabad- Lavish Surprises
Continue to next topic Fundamentals of Java|Data types.
Begin your career in Digital Marketing,What is digital marketing? Digital Marketing online course. It's an current evolving technology which can give support to establish your own startup through Digital Marketing.
Begin your career in Digital Marketing,What is digital marketing? Digital Marketing online course. It's an current evolving technology which can give support to establish your own startup through Digital Marketing.
Do check my new startup Surprise Planners in Hyderabad- Lavish Surprises
Hi Friends. Please comment down your views in the comment section below. Thank you...
No comments:
Post a Comment