Oracle 1Z0-808 Exam question no. 10

Q.- Given:-

public static void main(String [ ] args)  {
               int sum = 0;
               int xVal;
               for( xVal=1 ; xVal <= 5 ; xVal++)
               {
                      sum = sum + xVal ;
               }
     System.out.print("The sum of  " + xVal + " numbers is : "+sum);
}

What is the result ?

A) The sum of 5 numbers is : 15

B) The sum of 5 numbers is : 10

C) The sum of 4 numbers is : 10

D) A compile time error occurs.

E) None of these



⧪ please give your answer in a comment section.

Post a Comment

5 Comments