Single Choice Not Set

QChoose the correct statement
public class Circle{
      private double radius;  
      public Circle(double radius){
            radius = radius;
      }
}

ID: #2110 Declaration and Access Control in Java 1,420 views
Question Info
#2110Q ID
Not SetDifficulty
Declaration and Access Control in JavaTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A The program has a compilation error because it does not have a main method.
  • B The program will compile, but we cannot create an object of Circle with a specified radius. The object will always have radius 0.
  • C The program has a compilation error because we cannot assign radius to radius.
  • D The program does not compile because Circle does not have a default constructor.
Correct Answer

Explanation

The program will compile, but we cannot create an object of Circle with a specified radius. The object will always have radius 0.

Share This Question

Challenge a friend or share with your study group.

Related MCQ Questions