// Primitive Type Casting Order -- byte < short < int < long < float < double //
6. Program
//Find the O/P ? Compile Time Error or Compile Successfully
class F
{
static double test()
{
int i = 100;
return i;
}
public static void main(String[] args)
{
System.out.println(test());
}
}
7. Program
//Find the O/P ? Compile Time Error or Compile Successfully
class G
{
static int test(byte b)
{
return b;
}
public static void main(String[] args)
{
byte b = 10;
System.out.println(test(b));
}
}
8. Program
//Find the O/P ? Compile Time Error or Compile Successfully
class H
{
static int test(short s)
{
return s;
}
public static void main(String[] args)
{
byte b = 20;
double d = test(b);
System.out.println(d);
}
}
9. Program
//Find the O/P ? Compile Time Error or Compile Successfully
class I
{
static float test1(int i)
{
return test2(i);
}
static long test2(int i)
{
return i;
}
public static void main(String[] args)
{
byte b = 10;
double d = test1(b);
System.out.println("Done");
}
}
10. Program
//Find the O/P ? Compile Time Error or Compile Successfully
class J
{
static short test1(byte b)
{
return b;
}
static float test2(byte b)
{
return test1(b);
}
public static void main(String[] args)
{
byte b = 10;
double d = test2(b);
System.out.println("Done!!!");
}
}
Page....