Given the following class hierarchy, identify whether the me…

Given the following class hierarchy, identify whether the method scare is overloaded, overridden, or neither by the subclass: public class Spooky {    public void scare(int i, boolean b) { /* implemented */ }}public class Ghost extends Spooky {    public void scare(int num, boolean fright) { /* implemented */ }}

public class Bread {   public Bread() { System.out.println…

public class Bread {   public Bread() { System.out.println(“BREAD”); }}public class Toast extends Bread {   public Toast() { System.out.println(“TOAST”); }}public class AvocadoToast extends Toast {   public AvocadoToast() { super(); System.out.println(“AVO”); }} Given the class definitions above, what is printed to the console when the following lines of code are executed? Assume the code compiles and runs (i.e. ignore typos). Toast t = new Toast();AvocadoToast a = new AvocadoToast();

Given the following class hierarchy, identify whether the me…

Given the following class hierarchy, identify whether the method foo is overloaded, overridden, or neither by the subclass: public class Parent {    public void foo(int i, String s) { /* implemented */ }}public class Child extends Parent {    public void foo(int i) { /* implemented */ }}

public class Bread {   public Bread() { System.out.println…

public class Bread {   public Bread() { System.out.println(“BREAD”); }}public class Toast extends Bread {   public Toast() { System.out.println(“TOAST”); }}public class AvocadoToast extends Toast {   public AvocadoToast() { super(); System.out.println(“AVO”); }} Given the class definitions above, what is printed to the console when the following lines of code are executed? Assume the code compiles and runs (i.e. ignore typos). Toast t = new Toast();AvocadoToast a = new AvocadoToast();

public class Genre {   public Genre() { System.out.println…

public class Genre {   public Genre() { System.out.println(“GENRE”); }}public class MusicGenre extends Genre {   public MusicGenre() { System.out.println(“MUSIC”); }}public class Rock extends MusicGenre {   public Rock () { super(); System.out.println(“ROCK”); }} Given the class definitions above, what is printed to the console when the following lines of code are executed? Assume the code compiles and runs (i.e. ignore typos). MusicGenre g = new MusicGenre();Rock s = new Rock();