Skip to content

Latest commit

 

History

History
50 lines (37 loc) · 1.33 KB

File metadata and controls

50 lines (37 loc) · 1.33 KB

Question 1

  • Polymorphism in java is the ability for an object variable to be assigned as it's value any object that is part of a class that is a child of the variable's class
  • One place this is useful is creating methods that can take in many different objects as parameters
  • You could imagine a printing method that can print an array of different objects that are passed where maybe not all of those objects are the same.

Question 2

  • Without polymorphism when you tried to assign any non base object to object the program would crash.
  • Polymorphism allows this object to hold any of those variables

Question 3

  • This returns "A"

Question 4

  • This returns "~~B~~ A"

Question 5

  • "A A"

Question 6

  • The program will compile successfully

Question 7

  • The program will output 1

Question 8

  • "foo1: b a"

Question 9

  • "Name: fluffy\nSpecies: Canis Familaris(pomeranian)"
  • "Name: george\nSpecies: Canis Familaris"
  • "Name: brutus\nSpecies: Felis Catus"

Question 10

  • Unknown

  • Unknown

  • Error will not compile

  • 41

  • 49

  • y

  • 42

  • 7

  • Error will not compile

Question 11

  • You can not call abstract classes directly you can only call with super. (you can also make abstract methods

Question 12

  • you should include the basics of a car like the tires steering wheel axels that are shared amongst all cars.