Examveda

What is the result of the following code in Java?
Integer num = null;
int result = num + 5;

A. `5`

B. `null`

C. `Compilation error`

D. `Runtime error`

Answer: Option C


This Question Belongs to Java Program >> Java Autoboxing

Join The Discussion

Comments (1)

  1. Chaitanya Reddy
    Chaitanya Reddy:
    2 years ago

    this gives a null pointer exception not compliation error

Related Questions on Java Autoboxing

What is autoboxing in Java?

A. The automatic conversion of primitive types to their corresponding wrapper classes

B. The process of creating a new box

C. A feature for manually converting wrapper classes to primitive types

D. A feature for boxing objects