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

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

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

10条回答
  •  深忆病人
    2021-01-30 09:34

    Data Type: Are nothing but a reserved memory location to store values. meaning when you create a variable you reserve some space in memory.

    Literal: Is the source code representation of a fixed value, a Given or Constant value. Ex: boolean result = true, String s1 = "Hello World".

    boolean - is data type, result - is variable, true - is literal

    String - is Object data type, s1 - is variable, "Hello World" - is literal

提交回复
热议问题