What is the difference between data types and literals in Java?

前端 未结 10 1686
旧时难觅i
旧时难觅i 2021-01-30 08:59

What is the difference between data types and literals in Java?

10条回答
  •  既然无缘
    2021-01-30 09:30

    Int (Data type) x (Variable) = 100 (Literals) ;

    Data type :- Data type means type of data ,it may be byte, short, int , long, float , double ,char boolean and many other user defined type(Class) like Employee, Student etc...

    Literals :- The value we assign to variable is called Literal . e.g:- String str= "India"; Here "india" is string Literal .
    Literals are fixed value for a variable until they are not assign by other variable.

    true , false and null are reserved word in java. Technically they are literals values and not keywords .However they can not be used as Identifier because they have specific meaning to the java Compiler.

提交回复
热议问题