Question: What will the following code print when compiled and run? class Pett String name; Integer age; Pet (String n, Integer a) { this.name=n; this.age=a; 3

What will the following code print when compiled and run? class Pett String name; Integer age; Pet (String n, Integer a) { this.name=n; this.age=a; 3 public String toString() { return "The name of the pet is " + this.name + ". The age of the pet is " + this.age; 1 public class Dogworld public static void main(String args[]) { Pet p = new Pet ("Jane", 10); System.out.println(p); What will the following code print when compiled and run? public class Bird { private void fly() { System.out.println("Bird is flying"); ) public static void main(String[] args) { Bird bird = new Pelican(); bird.fly(); ) ) class Pelican extends Bird { protected void fly() { System.out.println("Pelican is flying"); 3 w For the toolbar
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
