Please do both What is wrong with the following program publ
Please do both
What is wrong with the following program? public class ShowErrors public class ShowErrors public static void main(String[) args) ShowErrors t-new ShowErrors(5) public static void main(String) args) ShowErrorst- new ShowErrorsO t.xO (al public class ShowErrors public class ShowErrors public void method1O public static void main(String) args) Circle c System.out-printinC What is radius Cc-new CCS.0) System.out.printin(c.value) c.getRadíus()); c- new CircleO a25 class int value 2; idi Solution
Please find the answers below:
1.a)
There is no constructor defined in the ShowErrors class with one argument, thus it will throw out error.
1.b)
There is no x() method defined in the class ShowErrors, thus it will throw compile time error, as cannot find symbol
1.c)
It will gives a compile time error, variable c might not be initialized
c.getRadius();
1.d)
It will give compile time error, because there is no single argument constructor is defined in the C class.
C c = new C(5.0);
2)
In class A, there is no no-argument constructor defined, and also if a single argument constructor is defined in class A, then the defaut construct also will not be generated.
