What is wrong with the following program? public class ShowErrors {public static
ID: 3929394 • Letter: W
Question
What is wrong with the following program? public class ShowErrors {public static void main(String[] args) {ShowErrors t = now ShowErrors(S):}} public class ShowErrors {public void method1 () {Circle c: System.out.println("What is radius " + c.getRadius()); c = new Circle():}} public class ShowErrors {public static void main(String[] args) {ShowErrors t = new ShowErrors(): t.x();}} public class ShowErrors {public static void main(String[] args) {C c = new C(5, 0); System.out .print ln(c. value):}} class C {int value =2;}Explanation / Answer
(a) :-
Answer : -
There's no constructor to accept the integer argument.
Answer : -
Method ShowErrors.x() doesn't exist.
Answer : -
c is a null pointer until initialized. Calling any instance method or instance attribute before initializing the object will fail.
Answer : -
No constructor to handle the floating value provided.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.