Suppose the class Undergraduate extends the class Student which extends the class Person. Given the following variable declarations: Person p = new Person(); Student s = new Student(); Undergraduate ug = new Undergraduate(); ArrayList list = new ArrayList(); Which of the following assignments are legal? Select all.
Added by Felix S.
Step 1
- Person p = new Person(); - Student s = new Student(); - Undergraduate ug = new Undergraduate(); - ArrayList list = new ArrayList(); Show more…
Show all steps
Your feedback will help us improve your experience
Akash M and 91 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Use these class headers to determine whether each assignment statement is valid or invalid. public interface FinancialAidEligible public abstract class Person public class Student extends Person public class Undergraduate extends Student implements FinancialAidEligible Person p1 = new Person(...); Person p1 = new Student(...); FinancialAidEligible p1 = new Student(...); FinancialAidEligible p1 = new Undergraduate(...); FinancialAidEligible p1 = new FinancialAidEligible (...); Student[] people = new Student[10]; Person[] people = new Person[10]; FinancialAidEligible[] people = new FinancialAidEligible[10];
Akash M.
2- Given 4 classes named student, which of the following is a valid constructor declaration for the class? int student student C: private final student() static void studento() {
Paul G.
Consider these class declarations: Which is a true statement? I Teacher inherits the constructors of Person. II Teacher can add new methods and private instance variables. III Teacher can override existing private methods of Person. (A) I only (B) II only (C) III only (D) I and II only (E) II and III only
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD