R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which of the following is the correct way to create an object?

  • (A) MyClass obj = new MyClass();
  • (B) MyClass obj();
  • (C) MyClass obj = MyClass();
  • (D) obj = new MyClass;
  • Correct Answer - Option(A)
  • Views: 19
  • Filed under category Java
  • Hashtags:

Explanation by: Ram Sharma
The correct syntax to instantiate a class is `new MyClass()`.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.