J

Jatin Dubey • 3.78K Points
Extraordinary

Q. What is the output for the below code ? 

Code:
class A{
      int k;
      boolean istrue;
      static int p;
      public void printValue(){
            System.out.print(k);
            System.out.print(istrue);
            System.out.print(p);
      }
}

public class Test{
      public static void main(String argv[]){
            A a = new A();
            a.printValue();
      }
}
  • (A) 0 false 0
  • (B) 0 true 0
  • (C) 0 0 0
  • (D) Compile error - static variable must be initialized before use.
  • Correct Answer - Option(A)
  • Views: 127
  • Filed under category JAVA

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics