Variables and Data types

Go down

Variables and Data types

Post by Sirex on Sun Aug 23, 2015 2:35 pm

Variables are nothing but reserved memory
locations to store values. This means that
when you create a variable you reserve some
space in memory.
Based on the data type of a variable, the
operating system allocates memory and
decides what can be stored in the reserved
memory. Therefore, by assigning different
data types to variables, you can store integers,
decimals, or characters in these variables.
There are two data types available in Java:
Primitive Data Types
Reference/Object Data Types

Primitive Data Types
There are eight primitive data types supported
by Java. Primitive data types are predefined
by the language and named by a keyword. They are :

  1. byte

  2. int

  3. short

  4. float

  5. double

  6. long

  7. char

  8. boolean

What Next

This Tutorials explained what variables are. In our next post, we will learn our to use them in our java programs.


Posts : 4
Points : 12122
Reputation : 0
Join date : 2015-08-20

View user profile

Back to top Go down

Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum