What is the result?

Given the code fragment:

What is the result?
A. An exception is thrown at runtime
B. Compilation fails
C. 13480.0
D. 13480 02

Download Printable PDF. VALID exam to help you PASS.

6 thoughts on “What is the result?

  1. 13480.0
    -int + float converts the int to a float. Then a float is returned
    -SIDE NOTE: the underscore can only be between two digits

  2. C:
    # javac Test26.java
    # java Test26
    13480.0
    ————
    (12345.01 >=12345.00) ?! yes, then var1 = 12456 and var2 = var1+ 1024, which is 13480

  3. public class Test {
    public static void main(String args[]) {
    float var1=(12_345.01 >= 123_45.00)?12_456:124_56.02f;
    float var2=var1+1024;
    System.out.println(var2);
    }
    }
    correct answer is c

    5
    1

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.