Saturday, September 5, 2015

How To Initialize Variable In Java

Hi All...!

Let's see how to initialize a variable in Java, In my post  "How To Declare Variable In  Java"  I told you how to declare a variable.

Variable initialization means assigning a value to a variable, we can do it in two ways,


Method 1


We can declare a variable first and then we can initialize it,

int i ;

i = 10;


Method 2


We can declare and initialize variable at the same time,


int i = 10; 

No comments:

Post a Comment