Java Program for Type Conversion
Get Job-ready: Java Course with 45+ Real-time Projects! - Learn Java
Program 1
class Test2
{
public static void main(String args[])
{
// byte a=(byte)(130);
// short s=32770;
// int i=13;
// byte b;
// b=(byte)(i);
byte b=20;
int i;
i=b;
System.out.println(i);
}
}Program 2
class Test3
{
public static void main(String args[])
{
byte a=50,b=30;
System.out.println(a);
System.out.println(b);
a=(byte)(a+b);
b=(byte)(a-b);
a=(byte)(a-b);
System.out.println(a);
System.out.println(b);
}
} Did you know we work 24x7 to provide you best tutorials
Please encourage us - write a review on Google

