Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started