GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

Author Archives: Anonymous

Fill in the blanks to implement the toString method. public…

Fill in the blanks to implement the toString method. public class Student {    private String name;    private String major;    private int year;    public 1 toString( 2 ) {        3    }}   1  :[1]   2  :[2]   3  :[3]

Read Details

Given the following class hierarchy, identify whether the me…

Given the following class hierarchy, identify whether the method explore is overloaded, overridden, or neither by the subclass: public class Traveler {    public void explore(String place, String name) { /* implemented */ }}public class Hiker extends Traveler {    public void explore(String n, String p) { /* implemented */ }}

Read Details

Fill in the blanks to implement the toString method. public…

Fill in the blanks to implement the toString method. public class Student {    private String name;    private String major;    private int year;    public 1 toString( 2 ) {        3    }}   1  :[1]   2  :[2]   3  :[3]

Read Details

Given the following class hierarchy, identify whether the me…

Given the following class hierarchy, identify whether the method explore is overloaded, overridden, or neither by the subclass: public class Traveler {    public void explore(String place, String name) { /* implemented */ }}public class Hiker extends Traveler {    public void explore(String n, String p) { /* implemented */ }}

Read Details

Given 3 classes (Sweater, Jacket, and Vest), Sweater can inh…

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

Read Details

Given 3 classes (Shark, Fish, and Predator), Shark can inher…

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

Read Details

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 num, String str) { /* implemented */ }} 

Read Details

Analyze the following code and indicate, for each line, whet…

Analyze the following code and indicate, for each line, whether autoboxing, unboxing, or neither occurs when the assignment operator is evaluated: char c = new Character(‘b’); //  1   occursCharacter a = c; //  2   occurs   1   : [1]   2   : [2]

Read Details

Car c1 = new Ford();Car c2 = new Honda();Ford f = new Ford()…

Car c1 = new Ford();Car c2 = new Honda();Ford f = new Ford();Honda h = new Honda(); For the class hierarchy and declarations above, correctly indicate whether each of the following statements will compile and what will happen at runtime (runs correctly or runtime exception). It may be helpful to use scratch paper to keep track of each variable’s static and dynamic type. 1  Car carA = (Car) f; 2   Ford fordA = (Ford) c1; 3  Ford fordB = (Ford) c2; 4  Ford fordC = (Ford) h;   1   : [1]  2   : [2]  3   : [3]  4   : [4]

Read Details

Analyze the following code and indicate, for each line, whet…

Analyze the following code and indicate, for each line, whether autoboxing, unboxing, or neither occurs when the assignment operator is evaluated: char c = new Character(‘b’); //  1   occursCharacter a = c; //  2   occurs   1   : [1]   2   : [2]

Read Details

Posts pagination

Newer posts 1 … 59,826 59,827 59,828 59,829 59,830 … 61,998 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top