Question: In SmartPhone, make a constructor that accepts the name and phone number. Save name and phone data in the superclass. Test Case 1 Name: Allan

In SmartPhone, make a constructor that accepts the name and phone number. Save name and phone data in the superclass.
Test Case 1
Name: Allan Hancock College Phone: 8059226966
Name: In-N-Out Burger Phone: 8007861000
Name: Costco Wholesale Phone:8059288459 public class Phone
{
protected String name;
protected long number;
public Phone(String name, long number){
this.name = name;
this.number = number;
}
public String toString(){
return "I am a phone!";
}}_______________________________
public class Demo3
{
public static void main(String[] args)
{
Phone p1= new SmartPhone("Allan Hancock College", 8059226966L);
Phone p2= new SmartPhone("In-N-Out Burger", 8007861000L);
Phone p3= new SmartPhone("Costco Wholesale", 8059288459L);
System.out.println(p1);
System.out.println(p2);
System.out.println(p3);
}
}

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 Programming Questions!