R

Rakesh Kumar • 28.44K Points
Instructor II

Q. Determine output:
public class Test{
      int a = 10;
    
      public void method(int a){
            a += 1;
            System.out.println(++a);
      }
      public static void main(String args[]){
            Test t = new Test();
            t.method(3);
      }
}

  • (A) 4
  • (B) 5
  • (C) 12
  • (D) 12 D. 11
  • Correct Answer - Option(B)
  • Views: 10
  • Filed under category JAVA

Explanation by: Rakesh Kumar
Here's an explanation of the code:

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics