Important Java Mcq 1

What is the output of the below Java program with constructors?

public class Constructor2
{
  int count=10;
  Constructor2(int count)
  {
    System.out.println("Count=" + count);
  }

  public static void main(String[] args)
  {
    Constructor2 con = new Constructor2();
  }
}
a) Count=0
b) Count=10
c) Compile error
d) None of the above

Answer

c) Compile error

Related MCQs
Aniket Malik

Aniket Malik

CERTIFIED TUTOR/TRAINER WITH 300+ REVIEWS

Facing difficulty with

this concept?