Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java Exam QUESTION 1 What is wrong in the following code? class Y { int i ; public Y ( int i ) { i
Java Exam
QUESTION
What is wrong in the following code?
class
int ;
public Yint i
this. ;
public class
public static void mainString args
new ;
A The program has a compilation error because does not have a default constructor.
B The program has a compilation error because does not have a constructor with an int
argument.
C The definition of the constructor should be this. ;
D Constructor of can not take argument named as the class has a member named
QUESTION
Analyze the following code:
public class Test
static double radius;
public static void mainString args
final double ;
double area radius radius ;
System.out.printInArea is area;
A The program has compile errors because the variable radius is not initialized.
B The program has a compile error because a constant is defined inside a method.
C The program has no compile errors but will get a runtime error because radius is not
initialized.
D The program compiles and runs fine but the area will be always
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