Data types

Datatypes in Java

  1. byte – whole numbers.
  2. short – whole numbers
  3. int – whole numbers
  4. long – whole numbers
  5. float – decimal numbers
  6. double – decimal numbers
  7. char – Charectors (It stores only one alphabet or numbers with single quotes)
  8. boolean – True or False

these are also called primitive data types. because all data types size fixed.

1.byte

size – 1 byte

Range – 128 to 127

2.short

size – 2 byte

Range – 32768 to 32767

3.int

size – 4 byte

Range – 2147483648 to 2147483647

4.long

size – 8 byte

Range – 9223372036854775808 to 9223372036854775807

5.float

size – 4 byte

Range – 3.14e+38 to 3.14e+38

6.double

size – 8 byte

Range –

7.char

size – 2 byte

Range –

8.boolean

size – 1 bit

Range –

Declaration

float height = 5.6;

int weight = 100;

char firstletter = ‘t’;

char totalweight=’9′;

boolean name=true;

another example –

int mark;

mark = 98;

Statical Programming Languages –

C, C++, C#, Java

Dynamic Programming Languages –

Python, Javascript, Php

Note

  • Data type is useless without creating variable.
  • A variable is meaningless without data type.

Class

Every class is non primitive data type

Without class there is no objects

Class is a template

It is a blueprint

Object

Object is represents the class

object is real time entity and real thing

objects has state and behaviour

Leave a comment