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

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

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

10条回答
  •  伪装坚强ぢ
    2021-01-30 09:45

    From Java Data types tutorial

    Data types :

    Primitive types are special data types built into the language; they are not objects created from a class

    Literal :

    A Literal is the source code representation of a fixed value; literals are represented directly in your code without requiring computation

    boolean result = true;
    
    boolean - is data type
    true - is literal
    

提交回复
热议问题