DEV Community

Cover image for Data types in Java
Kumar Sanskar
Kumar Sanskar

Posted on

Data types in Java

Another day in the journey of learning Java, well it's day 4 and today I will talk about the very essential component in any programming language 'data types', it can be thought as that important label without which we won't be able to identify the type of food kept in a container in kitchen.
Like every programming language, Java too has data types in order to facilitate the working on data and operations to be performed upon the data input by the user.
Java being a strongly typed language makes sure that all operations are checked for data type compatibility and illegal operations are rejected by the compiler. Furthermore the presence of data types makes it easier to determine what kind of operation are allowed on each type of data.

  • Java has two kinds of data types :-

    1. Primitive Data type
    2. Reference Data type
  • Primitive Data Types -

    • they are also called the built-in data type.
    • Java has eight types of data defined as primitive data types and they are:-

    i. Byte
    ii. Short
    iii. Char
    iv. Int
    v. Long
    vi. Float
    vii. Double
    viii. Boolean

  • Reference Data Type -

    • it is also called as derived data type or non-primitive data type in Java.
    • they refer to objects and are created by programmer.
    • it has two subtypes :-

    i. String, arrays, classes, intefaces.
    ii. BigInteger,BigDecimal......and so on.

That's it for today my readers, see you in the next blog till then keep learning keep growing, also you can put any suggestion or remarks if you feel or point mistake that may have crept in.

Discussion (0)