Question: how you would create two instances of the two classes ? class Person Girl Pers double speed; public void play() { System.out.println(Person is playing); }

how you would create two instances of the two classes ?

how you would create two instances of the two classes ? class

class Person Girl Pers double speed; public void play() { System.out.println("Person is playing"); } public void sleep() System.out.println("Person is sleeping"); } } class Girl extends Person public void play System.out.println("Girl is playing"); // overriding the method and print out another text } public class Main { public static void main(String args[]) { Girl girl = new Girl(); girl.play(); // Calling the method play from Girl class girl.sleep(); // calling the method sleep from Person class }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!