Share
Explore BrainMass

Solving various questions on output of Java code

What is the output of this code sequence?
Double a = 12.5;
System.out.println (a);

What is the output of this code sequence?
Float a = 13f;
System.out.println (a);

What is the output of this code sequence?
Int a = 13 /5;
System.out.println (a);

What is the output of this code sequence?
Int a = 12 / 6 *2;
System.out.println (a);

What is the output of this code sequence?
Int a =4 + 6 /2;
System.out.println (a);

What is the output of this code sequence?
Double a = 12.0 /5;
System.out.println (a);

What is the output of this code sequence?
Double a = (double) (12) /5;
System.out.println (a);

What is the output of this code sequence?
Int a=5;
A++;
System.out.println (a);

What is the output of this code sequence?
Int a =5
System.out.println (--a);

What is the output of this code sequence?
Int a=5;
A /= 6;
System.out.println (a);

Write the pseudocode for a program that finds the product of two numbers.

Write the pseudocode for a program that finds the sums of the numbers input that are greater than or equal to 10 and the numbers input that are less than 10.

Solution Preview

What is the output of this code sequence?
Double a = 12.5;
System.out.println (a);
ans: 12.5 as a is of a double type.

What is the output of this code sequence?
Float a = 13f;
System.out.println (a);
ans: 13.0 as a is of a float type.

What is the output of this code sequence?
Int a = 13 /5;
System.out.println (a);
ans: 2 as only integer part is printed

What is the output of this code sequence?
Int a = 12 / 6 *2;
System.out.println (a);
ans: 4 as divison is processed first.

What is ...

Solution Summary

The solution gives complete solutions for various questions on output of Java code. Each question is discussed in details.

$2.19