Java Programming and Technical Programming Program

What is the output of this program?

class conversion {
public static void main(String args[])
{
double a = 295.04;
int b = 300;
byte c = (byte) a;
byte d = (byte) b;
System.out.println(c + " " + d);
}
}
a) 38 43
b) 39 44
c) 295 300
d) 295.04 300

Read Solution (Total 12)

Java Other Question

What is the output of this program?

class average {
public static void main(String args[])
{
double num[] = {5.5, 10.1, 11, 12.8, 56.9, 2.5};
double result;
result = 0;
for (int i = 0; i < 6; ++i)
result = result + num[i];
System.out.print(result/6);

}
}
a) 16.34
b) 16.566666644
c) 16.46666666666667
d) 16.46666666666666
What is the output of this program?

class area {
public static void main(String args[])
{
double r, pi, a;
r = 9.8;
p1 = 3.14;
a = pi * r * r;
System.out.println(a);
}
}
a) 301.5656
b) 301
c) 301.56
d) 301.56560000