Variables Initialization Program in Java
public class VariablesInitialization
{
public static void main(String[] args)
{
// TODO code application logic here
boolean flag=true;
System.out.println(flag);
System.out.println("Flag="+flag);
System.out.println("--------------------");
char ch='A';
System.out.println(ch);
System.out.println("Ch="+ch);
System.out.println("Ch as ASCII code="+(int)ch);
System.out.println("--------------------");
int number=10;
System.out.println(number);
System.out.println("Number="+number);
System.out.println("--------------------");
float f1=10, f2=10.99f;
System.out.println(f1);
System.out.println("Float="+f1);
System.out.println(f2);
System.out.println("Float f2="+f2);
System.out.println("--------------------");
String name="India";
System.out.println(name);
System.out.println("Name="+name);
}
}
Output:
A Ch=A Ch as ASCII code=65 -------------------- 10 Number=10 -------------------- 10.0 Float=10.0 10.99 Float f2=10.99 -------------------- India Name=Indiab. tech. bca icse java mca programs