Question: QUESTION 5 What is wrong with the following code: class Circle { double radius; double diam; double area ( ) { return radius * radius
QUESTION
What is wrong with the following code:
class Circle
double radius;
double diam;
double area return radius radius :;
void diameter diam radius :;
public static void mainString args
Circle new Circle;
cradius ;
cdiameter;
System.out.printlncarea;
A radius and diam are dependent, so one of them should me a method.
B The method diameter should return double.
C radius should be private.
D The class has no constructor
QUESTION
What is the output of the following program
class X
final int ;
;
public static void mainString args
newx;
System.out.printlnXa xa;
A X;
B X;
C The program has error because a is not static.
D The program has error because a should be initialized when it is declared.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
