R

Rakesh Kumar • 28.44K Points
Instructor II

Q. What is the output of the following program?
class A{
public static void main(String args[]){
byte b;
int i = 258;
double d = 325.59;

b = (byte) i;
System.out.print(b);

i = (int) d;
System.out.print(i);

b = (byte) d;
System.out.print(b);
}
}

  • (A) 258 325 325
  • (B) 258 326 326
  • (C) 2 325 69
  • (D) Error
  • Correct Answer - Option(C)
  • Views: 43
  • Filed under category JAVA

Explanation by: Rakesh Kumar
In the type cast

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics