Which statement is true?

Given the content of three files:

Which statement is true?
Which statement is true?
A. Only the A.Java file compiles successfully.
B. Only the B.java file compiles successfully.
C. Only the C.java file compiles successfully.
D. The A.Java and B.java files compile successfully.
E. The B.java and C.java files compile successfully.
F. The A.Java and C.java files compile successfully.

Download Printable PDF. VALID exam to help you PASS.

4 thoughts on “Which statement is true?

  1. A
    public class Q88 {
    private int doStuff(){
    private int x =100;// private here not allowed already x is local variable
    return x++;
    }
    }

  2. Correct answer is A.

    B.java does not work because we can’t have private or protected variables in a block.
    C.java can’t be compiled because of many errors (i.e. filename, package declaration …)

  3. Answer D:

    Class “C” will not compile because the file name is not matching the class name.

    1
    6

Leave a Reply

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


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