What is the result?


What is the result?
A. Area is 6.0
B. Area is 3.0
C. Compilation fails at line n1
D. Compilation fails at line n2.

Download Printable PDF. VALID exam to help you PASS.

5 thoughts on “What is the result?

  1. area is static, no need to be declared in main, is already declared in Triangle class -> can be used without object creation in main.

    answer is A

  2. //The local variable h may not have been initialized

    D : Compilation fails at line n2.

  3. Answer D:

    You can declare local variables in a method, but you cannot do any operations on them before initializing them. For that reason, we have no issues at line n1, but we do at line n2.


Leave a Reply

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

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