Related post

Java variable :How to declare a variable in Java

 

Java variables

What is a variable ?

A variable is container that stores data , text or numbers. A variable must have a name and also data assigned to it. 

      SYNTAX


data_type  variable_name  =  value

  


Check this 

   int x = 5 ;

Int -- is a data type 

X -- variable name

= -- assignments operator

5 -- value

The best way to declare a variable is simply by declare the data type, state the variable name and then assign a value to it. We would discuss more on data types.


Here are some important things you should know when declaring a variable. 

They are :


• Variable names are case sensitive in Java

• Variable names must not have whitespace, something like this -- int num


Other examples are :



String firstName;

  Boolean isTall =  True;

  Int a , b , c ;


  


Let's move


Break statement in Java


Continue statement in Java


Inheritance in Java



 pleasese share 







Follow us on




Comments