What is the result if the integer aVar is 9?

Given the code fragment:

What is the result if the integer aVar is 9?
A. 10 Hello World!
B. Hello Universe!
C. Hello World
D. Compilation fails.

Download Printable PDF. VALID exam to help you PASS.

2 thoughts on “What is the result if the integer aVar is 9?

  1. A :
    # javac Test1.java
    # java Test1
    10 Hello world!

    Obviously in IF statement it firstly evaluates that 9 < 10 then increases aVar++ and proceeds to aVar + "Hello world!

Leave a Reply

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