Pages

Sunday, October 4, 2015

Java beginner programming declaring variable and describing data type

                      java most beginner tutorial 


                Data types ,variable    



public class{
public static void main(String[]args){ 


/*to declare variable these are the codes make sure  to spell them 

correct other wise it wont work*/  

// to declare int 

int ab = 33; 


/* you can't initialize any decimal value or text in an int.other wise it
would give an error..so being very careful.. for the decimal value there

 is a specific data type called double  ..so if you need to have some decimal 

values in java so you can  declare them with double like below*/  


double aa = 33.33;



/* so string is actually use for text values like if you wanna print out

some text with variable so you can do this thing like below*/ 



String ac = "how are you";

         System.out.println(ab);

System.out.println(aa);

         System.out.println(ac);



/*now if you wanna change your int to string so below is the process*/  


int d = 39;
String e=Integer.toString(d);
System.out.println(e); 



/*if you wanna change your String into int or double so the process is below */ 

String f ="44"; 


int g = Integer.parseInt(f);
System.out.println(g);

 //you cant change text value to int so thats the point

/*how to get the maximum value of an int double or float */ 


System.out.println(Integer.MAX_VALUE);
System.out.println(Double.MAX_VALUE);
System.out.println(Float.MAX_VALUE); 

 /*how to get minimum value*/ 



System.out.println(Integer.MIN_VALUE);
 

}

}



To watch video for this click me

No comments:

Post a Comment