package javaapplication3;
import java.util.Scanner;
public class JavaApplication3
{
public static void main(String[] args)
{
byte b=127;
System.out.println("value of byte variable is "+b);
short s=32767;
System.out.println("value of short variable is "+s);
long l=659685085;
System.out.println("value of long variable is "+l);
int i=654654;
System.out.println("value of int variable is "+i);
float f=5.323232f;
System.out.println("value of float variable is "+f);
double d=543545435.43;
System.out.println("value of double variable is "+d);
char c='a';
System.out.println("value of char variable is "+c);
boolean bo=true;
System.out.println("value of boolean variable is "+bo);
System.out.println("------------------------------------------------");
Scanner obj=new Scanner(System.in);
b=obj.nextByte();
System.out.println("value of byte variable is "+b);
s=obj.nextShort();
System.out.println("value of short variable is "+s);
l=obj.nextLong();
System.out.println("value of long variable is "+l);
i=obj.nextInt();
System.out.println("value of int variable is "+i);
f=obj.nextFloat();
System.out.println("value of float variable is "+f);
d=obj.nextDouble();
System.out.println("value of double variable is "+d);
c=obj.next().charAt(0);
System.out.println("value of char variable is "+c);
}
}
No comments:
Post a Comment