Question: I need help with my computer science class. Question 1 Consider the following client code and assume that it compiles correctly: public class MyTesterClass {

I need help with my computer science class.

Question 1

Consider the following client code and assume that it compiles correctly: public class MyTesterClass { public static void main(String[] args) { MyClass myObject = new MyClass (12.4, 20); int value1 = MyClass.SOME_VALUE; int value2 = myObject.method1(); int value3 = MyClass.method2(20); } } Which of the following is a class method?

method1

method2

MyClass

SOME_VALUE

This cannot be determined by examining the above code

Question 2

A public class method may be invoked after which of the following occurs?

The class is defined.

The main method is defined.

All instance variables are assigned.

An instance of the class is created.

The instance methods are invoked.

Question 3

Consider the following incomplete class: public class MyClass { public static void someMethod() { // implementation not shown } public void someOtherMethod() { // implementation not shown } private void yetAnotherMethod() { // implementation not shown } } The method someMethod is defined as static. This means

the method is accessible outside MyClass

the method is not accessible outside MyClass

the method is an accessor method of MyClass

the method is accessible without instantiating a MyClass object

the method is accessible only by using a previously instantiated MyClass object

Question 4

When one method calls another, which of the following statements are true?

  1. The class methods and instance methods of one class may call the public class methods of another class using dot notation and referencing the name of the other class.
  2. The class methods and instance methods of one class may call the public instance methods of another class by using dot notation to invoke the method on an instance of the other class.
  3. The instance methods of a class may call, only using dot notation, any class method of the same class.

I only

III only

I and II only

I and III only

I, II, and III

Question 5

Which of the following describes an overridden method?

Any method that invokes super();

A method that contains a call to itself

One of many methods in a class with the same name but different return values

One of many methods in a class with the same name but different parameter lists

A method in a subclass with the same method heading as a method in a parent class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!