adplus-dvertising
frame-decoration

Question

What is the output of the following Java Code?
int a=9;
float b = a/2;
System.out.println(b);

a.

4.0

b.

4.5

c.

5.0

d.

None of the above

Posted under Java Programming

Answer: (a).4.0

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of the following Java Code?

Similar Questions

Discover Related MCQs

Q. In a lossy Type Casting or Type Conversion, how is the number truncated to the target data type in Java?

Q. A boolean literal in Java can be type casted to which data type?

Q. If a variable or operand in an expression is type long, then all the operands are type promoted to which data type?

Q. An Array in Java is a collection of elements of ___ data type.

Q. The Java Virtual Machine (JVM) implements arrays as ___ type.

Q. Unlike C-Arrays, the Java-Arrays have ___.

Q. An array declaration in Java without initialization ___ memory.

Q. In Java language, an array index starts with ___.

Q. Which are the special symbols used to declare an array in Java?

Q. Which are the special symbols used to initialize an array at the time of the declaration itself?

Q. It is possible to skip initializing some elements of the array during Shorthand Initialization. (TRUE / FALSE)

Q. In Java, an array can be declared without initialization without mentioning the size. (TRUE / FALSE)

Q. Which is the correct way of knowing Array Size in Java?

Q. We should not specify the array size if declaration and initialization are done at the same time. (TRUE / FALSE)

Q. If an index of an element is N, what is its actual position in the array?

Q. An array in Java can be declared only of some predefined types. (TRUE/FALSE)

Q. The name of an array variable or identifier can start with ___.

Q. Shorthand array initialization in Java needs the keyword "new" to allocate memory to the array and elements. State TRUE or FALSE.

Q. Lazy initialization of array requires the keyword "new" to allocate memory to the array and its elements. State TRUE or FALSE.

Q. What is the default value of an element of Object type array?