Oracle 1Z0-808 Exam question no. 62

Q.– Given: 

public class Triangle  {
       static double area; 
       int b = 2, h = 3; 
       public static void main(String[ ] args ) {
            double p, b, h;             // line n1 
            if (area == 0) { 
                   b = 3; 
                   h = 4; 
                   p = 0.5; 
                   area = p* b* h;    // line n2
           }
           System.out.println("Area is " + area) ; 
       }
}

What is the result? 

A) Compilation fails at line n2. 

B) Area is 3.0 

C) Area is 6

D) Compilation fails at line n1.


⧪ please give your answer in a comment section.

Post a Comment

4 Comments