GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

Author Archives: Anonymous

public class SportsEquipment {      public SportsEquipment (…

public class SportsEquipment {      public SportsEquipment () {          System.out.println(“SPORTS”);      } } public class Ball extends SportsEquipment {     public Ball() {     super();         System.out.println(“BALL”);      } } public class BasketBall extends Ball {     public BasketBall () {         System.out.println(“BASKETBALL”);      } }  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). Ball b = new Ball(); BasketBall bb = new BasketBall(); 

Read Details

Given the following class hierarchy, identify whether the me…

Given the following class hierarchy, identify whether the method introduce is overloaded, overridden, or neither by the subclass: public class Person {    public void introduce(String name, int height) { /* implemented */ }}public class Student extends Person {   public void introduce(String name, int height, String major) { /* implemented */ }}

Read Details

                . ‘  .           ‘ .( ‘.) ‘     _   (‘-.SH…

                . ‘  .           ‘ .( ‘.) ‘     _   (‘-.SHOW )’ (`’     | (- -(. ‘)` YOUR (-) ‘  .–`+’-. .  (‘ SCRATCH ‘) .  |`—-‘|   (‘ .) PAPER )  | /..\ |    . (‘ `.  )   |\./\.\|      ` .  `   |./G \/|  |.\ T/.|  `-._/.-‘

Read Details

Given the following class hierarchy, identify whether the me…

Given the following class hierarchy, identify whether the method price is overloaded, overridden, or neither by the subclass: public class Drink {   public void price(int p, String n) { /* implemented */ } } public class Pepsi extends Drink {   public void price(int price, String name) { /* implemented */ } } 

Read Details

Given 3 classes (Shark, SeaCreature, and Fish), Shark can i…

Given 3 classes (Shark, SeaCreature, and Fish), Shark can inherit from both SeaCreature and Fish with the following syntax: public class Shark extends SeaCreature, Fish { /* valid class definition */}

Read Details

Given the following class hierarchy, identify whether the me…

Given the following class hierarchy, identify whether the method introduce is overloaded, overridden, or neither by the subclass: public class Person {    public void introduce(String name, int height) { /* implemented */ }}public class Student extends Person {   public void introduce(String name, int height, String major) { /* implemented */ }}

Read Details

public class SportsEquipment {      public SportsEquipment (…

public class SportsEquipment {      public SportsEquipment () {          System.out.println(“SPORTS”);      } } public class Ball extends SportsEquipment {     public Ball() {     super();         System.out.println(“BALL”);      } } public class BasketBall extends Ball {     public BasketBall () {         System.out.println(“BASKETBALL”);      } }  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). Ball b = new Ball(); BasketBall bb = new BasketBall(); 

Read Details

public abstract class Airline {     public abstract long sel…

public abstract class Airline {     public abstract long sellPlane(); }  Consider the class shown above. Which of the following class definitions will NOT compile? 

Read Details

Given the following class hierarchy, identify whether the me…

Given the following class hierarchy, identify whether the method eat is overloaded, overridden, or neither by the subclass:  public class Animal {   public void eat(String food) { /* implemented */ } } public class Dog extends Animal{   public void eat(String food, int quantity) { /* implemented */ } } 

Read Details

You have files Parent.java, Child.java, and a driver class n…

You have files Parent.java, Child.java, and a driver class named Driver.java. Fill in the correct visibility modifiers so that the comments in the class Child and Driver’s main method are upheld. public class Parent {   1 void method1() { /*compiles*/ }   2 void method2() { /*compiles*/ }   3 void method3() { /*compiles*/ } } —– in a separate file in a different package/directory —– public class Child extends Parent {   public void foo() { method1(); // compiles method3(); // doesn’t compile }} —– in a separate file in a different package/directory —– public class Driver { public static void main(String[] args) { Child c = new Child(); c.method1(); // doesn’t compile c.method2(); // compiles c.method3(); // doesn’t compile }}   1   : [1]  2   : [2]  3   : [3]

Read Details

Posts pagination

Newer posts 1 … 79,491 79,492 79,493 79,494 79,495 … 81,658 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top