Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Class Declarations public class Parent public void namel System.out.println(Parent); d public void age { Systen.out.println(Old); 1 } public class Child extends Parent { public void

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Class Declarations public class Parent public void namel System.out.println("Parent"); d public void age { Systen.out.println("Old"); 1 } public class Child extends Parent { public void name() System.out.println("Child": ) public void age System.out.println("Young) } public void grade() System.out.println("10"): Which of the following statements will cause a compile time error? 1. Parent person = new Child(); person.grade(): 2. Child person = new Child(); person.grade(): 3. Parent person = new Parent(): person. age(); 4. Parent personne Child(): personage(): 66% canvas instructure.com Consider the following class declarations public class Park { private String name; public Park(String name) this.name = name; > public String toString() return name + park"; } } public class Field extends Park { private String type; public Field(String name, String type) { super (name); this.type type; ) public String toString() return super.toString() + " with a " + type="field" > A code segment located in a different class produced the following output Centennial park with a soccer field Which of the following code segments will produce that output? 66% canvas.instructure.com produced the Tollowing output Centennial park with a soccer field Which of the following code segments will produce that output? 1. Park cent = new Park("Centennial", "Socc er"); System.out.println(cent); II. Park cent = new Field("Centennial", "soc cer"); System.out.println(cent); III. Field cent = new Field("Centennial", "so ccer"); System.out.println(cent); Only II Only Ill only Il and Ill Only Question 8 1 pts Consider the following class declarations public class Car { * Implementation Not Shown / } public class ElectricCar extends Car /* Implementation Not Shown */ } The following line of code appears in a test class: ArrayList Which of the following objects can be added to the ArrayList? I. Car leat = new ElectricCar(); II. Car mustang = new Car(); III. ElectricCar model3 = new ElectricCar(); 1 Only I and II only I and Ill only Ill only OIHI, III Question 9 1 pts Which of the following is the best example of a Superclass / Subclass relationship? Balloon / Color Team / Mascot Student / Grade Shirt / Button Fruit / Banana

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions