Java Program - 02
Write a Java program to show the concept or use of Data Type.
//Java Program to show the use of simple/premitive data types. class StudyViral_02{ public static void main(String []args){ byte byteCar = 100; short shortVar = 123; int intVar = 123456; int calcVar = -98765432; long longVar = 1234567891L; float floatVar = 12.356F; double doubleVar = 123456.6666d; boolean flag = true; boolean val = false; char ch1 = 89; char ch2 = 'Z'; System.out.println("byte value = "+byteCar); System.out.println("short Value = "+shortVar); System.out.println("int Value = "+intVar); System.out.println("long Value = "+longVar); System.out.println("float Value = "+floatVar); System.out.println("double Value = "+doubleVar); System.out.println("boolean Value = "+flag); System.out.println("boolean Value ="+val); System.out.println("char ch1 = "+ch1); System.out.println("char ch2 = "+ch2); } }
Output::
byte value = 100 short Value = 123 int Value = 123456 long Value = 1234567891 float Value = 12.356 double Value = 123456.6666 boolean Value = true boolean Value =false char ch1 = Y char ch2 = Z
0 comments:
Post a Comment