OCA Java SE 8 Mock Exam Review - OCA Mock Question 20








Question

Which of the following statements are true?

public class Main {  
   public Main(int i, float f) { }  
   public Main(float f, int i) { } 
   public Main(float f) { } 
   public void Main() { } 
} 
  1. A syntax error will occur because void cannot be used with a constructor.
  2. A syntax error will occur because the first two constructors are not unique.
  3. The class does not have a default constructor.
  4. No syntax errors will be generated.




Answer



C and D

Note

The last Main method happens to have the same name as the constructor.

The class has no default constructor.