Question
Please help to answer ASAP
Class Parent {Parent(String s) {System.out.printl
0 0
Add a comment Improve this question Transcribed image text
Answer #1

super(); //Automatically inserted here in .class file of Child.

Compilation error.

These are the correct statements with the above code.

Add a comment
Know the answer?
Add Answer to:
Please help to answer ASAP Class Parent {Parent(String s) {System.out.println("S1");}} class Child extends Parent {public Child()...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • What is the output of the following code? class parent { public void someFunction() { System.out.println("Parent...

    What is the output of the following code? class parent { public void someFunction() { System.out.println("Parent Function"); } } public class child extends parent { public void someFunction() { System.out.println("Child Function"); } public static void main(String args) { parent p1 = new parent(); parent p2 = new child(); child c1 = new child(); p1.someFunction(); p2.someFunction(); c1.someFunction(); } }

  • public class Game{ public void players() { System.out.println(“1 or more”); } } public class Chess extends...

    public class Game{ public void players() { System.out.println(“1 or more”); } } public class Chess extends Game { public void boardSize() { System.out.println(“8 by 8”); } public void players() { System.out.println(“2”); } } public class ThreeDChess extends Chess{ public void boardSize() {System.out.println(“7 levels”); } public void hasMoveableBoard() { System.out.println(“true”); } } Assume that these statements have already executed: Game g = new Game(); Chess c = new Chess(); ThreeDChess t = new ThreeDChess(); Object og = g; Game gc =...

  • public class SquareTest {    public static void main(String[] args) {               System.out.println("Number...

    public class SquareTest {    public static void main(String[] args) {               System.out.println("Number of sides is " + Square.NUM_OF_SIDES);                      Square s1 = new Square(-5.7f);               System.out.println(s1);               s1.setLength(0.001f);        System.out.println(s1.getLength());               s1.setLength(-9999);        System.out.println(s1.getLength());               System.out.println("Number of sides is " + s1.NUM_OF_SIDES);               s1.calculateArea();                            } }...

  • class Test public static void main(String args) { Aa=new AO: a.printo: class A private String s;...

    class Test public static void main(String args) { Aa=new AO: a.printo: class A private String s; public A (String news) { 8 = news: public void print { System.out.println(s): The program would compile and run if you change A a new Alto Aa=new A('5'). The program has a compilation error because the instance variables in class A is not public. The program has a compilation error because class A does not have a no-arguments constructor The program compiles and runs...

  • What causes an assertion error in JAVA on this? Code: public class Student extends Staff {...

    What causes an assertion error in JAVA on this? Code: public class Student extends Staff {        private String s1;        private String s2;        public Student (String firstName, String lastName, String s1, String s2) {              this.s1 = s1;              this.s2 = s2;        }        public boolean equals(Person s){              if (s == null) return false;                          return ((this.s1).equals(this.s2));        } } Test Case:        public void areTheyEqualTest() {              Student             s1     = new Student( FIRST_NAME, LAST_NAME);             ...

  • I need help with this Mammal: public class Mammal extends Pet{     String Vaccin...

    I need help with this Mammal: public class Mammal extends Pet{     String Vaccination="";     public Mammal(String name, String parent, String species, String birthday, String Vaccination) {           //Accessing the super class Constructor and setting the variables.         super(name,parent,species, birthday);         this.Vaccination=Vaccination;     } // end Mammal     public String getVaccination() {         return Vaccination;     } // end getVaccination     public void setVaccination(String Vaccination) {         this.Vaccination = Vaccination;     } // end setVaccination     @Override     public String toString() {         return super.toString()+". This Mammal requires following vaccinations "+ Vaccination;     } // end...

  • What is output? public abstract class People { protected string name; protected int age; public abstract...

    What is output? public abstract class People { protected string name; protected int age; public abstract void PrintInfo(); public void PrintInformation() { System.out.println("In Base Class People"); public class Teacher extends People { private int experience; public void PrintInfo() { System.out.println("In Child Class Teacher"); public class Principal extends Teacher { public void PrintInformation() { System.out.println("In Child Class Principal"); public static void main(String args[]) { Principal tim; tim = new Principal(); tim.PrintInfo(); In Base Class People Error: Compiler error In Child Class...

  • For Questions 1-3: consider the following code: public class A { private int number; protected String...

    For Questions 1-3: consider the following code: public class A { private int number; protected String name; public double price; public A() { System.out.println(“A() called”); } private void foo1() { System.out.println(“A version of foo1() called”); } protected int foo2() { Sysem.out.println(“A version of foo2() called); return number; } public String foo3() { System.out.println(“A version of foo3() called”); Return “Hi”; } }//end class A public class B extends A { private char service; public B() {    super();    System.out.println(“B() called”);...

  • For Questions 1-3: consider the following code: public class A { private int number; protected String...

    For Questions 1-3: consider the following code: public class A { private int number; protected String name; public double price; public A() { System.out.println(“A() called”); } private void foo1() { System.out.println(“A version of foo1() called”); } protected int foo2() { Sysem.out.println(“A version of foo2() called); return number; } public String foo3() { System.out.println(“A version of foo3() called”); Return “Hi”; } }//end class A public class B extends A { private char service; public B() {   super();   System.out.println(“B() called”); } public...

  • Consider the following codes: public class TestThread extends Thread {     public static void main(String[] args)...

    Consider the following codes: public class TestThread extends Thread {     public static void main(String[] args) {         TestThread thread = new TestThread();     }     @Override     public void run() {         printMyName();     }     private void printMyName() {         System.out.println("Thread is running");     } } Test Stem / Question Choices 1: What method should you invoke to start the thread TestThread? A: start() B: run() C: No. Thread will run automatically when executed. D: TestThread is not...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT