Java Data types

 Data Type

Quiz Link : https://take.quiz-maker.com/QJR4DF2A9

 different sizes and values that can be stored in the variable.

  • Basic mean of the data type is What is the type of data
  •  Example:

  1. 10 is a data stored in memory so the type of this data is Integer type .
  2. 'manvik' is a data stored in memory so the type of this data is string type.
  3. false is a data stored in memory so the type of this data is Boolean.
There are 2 type of Data types:
Primitive data types(value type): 
  1. Predefined by the language and is named by a reserved keyword.
  2. Created only in stack.
  3. Boolean, char, int, byte, short, double, float, long these types of data types called primitive data types.
Non-primitive data types(reference type):
  1. Created by the programmer and is not defined by Java .
  2. Classes, Arrays, interfaces etc. are non-primitive data type.
  3. Created in Heap.  

  • Boolean data type: Boolean data type only work on True and false  value.
                Ex: engineers are smart 🧠 true or false 
                     answer : Ture ☺.
  • character data type(char): Used to store Character.
               Ex: 'A' is character can store in memory by the help of char keyword.
  • Integer data types: Integer data type can take values in range -2147483648 to +2147483647.
=>parts:
  1. byte(save memory(-128-127))
  2. short(save memory(-32,768 to 32,767))
  3. int
  4. long(The long data type is used when you need a range of values more than those provided by int(-9,223,372,036,854,775,808(-2^63) to 9,223,372,036,854,775,807(2^63 -1)))
  • Floating : Store double-precision floating point value (unlimited range).
              Ex: 1.8 is a floating point value.
=>parts: 
  1. Floating(unlimited range)0.0f(default value)
  2. Double(unlimited range)0.0d(default value).
  • Chart(show default value and size of primitive data types):


Primitive Data type (soon)






Comments