Thursday, March 31, 2022

Java Program For Data Types Part-2

 package selenium;

public class Datatypes {

public static void main(String[] args) {

//single line variable declaration

int a=10, b=20, c=30;

System.out.println(a);

        System.out.println(b);

System.out.println(c);

System.out.println(a+b); // add the a,b value

  long c1=123456789L; //Long data type

        System.out.println(c1);

    

                 int person_age=30; // Number data type

        System.out.println(person_age);

 float item_price=15.5f; //have to specify with f character if it is a float

 System.out.println(item_price);

char grade='B'; // Char data type

System.out.println(grade);

boolean status1=true;

boolean status2=false;

System.out.println(status1+" "+status2);

String person_name="Suriya Parithy"; // Name data type

System.out.println(person_name);

}

}

No comments:

Post a Comment