1. It is discovered a class has two constructors. This is an example of (4 points) overriding overloading inheritance po
Posted: Sun May 15, 2022 8:00 am
1.
It is discovered a class has two constructors. This is an
example of (4 points)
overriding
overloading
inheritance
polymorphism
instantiation
2.
A method defined within a class and whose header does NOT
include the static modifier is known as which of the following? (4
points)
class method
instance method
super method
private method
public method
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 yetAnotherMethod is defined as private. This
means (4 points)
the method is accessible outside MyClass
the method is not accessible outside MyClass
the method is accessible only by a static method
of MyClass
the method is accessible without instantiating
a MyClass object
the method is accessible only by using a previously
instantiated MyClass object
4.
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? (4 points)
method1
method2
MyClass
SOME_VALUE
This cannot be determined by examining the above code
5.
When one method calls another, which of the following statements
are true? (4 points)
I only
III only
I and II only
I and III only
I, II, and III
It is discovered a class has two constructors. This is an
example of (4 points)
overriding
overloading
inheritance
polymorphism
instantiation
2.
A method defined within a class and whose header does NOT
include the static modifier is known as which of the following? (4
points)
class method
instance method
super method
private method
public method
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 yetAnotherMethod is defined as private. This
means (4 points)
the method is accessible outside MyClass
the method is not accessible outside MyClass
the method is accessible only by a static method
of MyClass
the method is accessible without instantiating
a MyClass object
the method is accessible only by using a previously
instantiated MyClass object
4.
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? (4 points)
method1
method2
MyClass
SOME_VALUE
This cannot be determined by examining the above code
5.
When one method calls another, which of the following statements
are true? (4 points)
I only
III only
I and II only
I and III only
I, II, and III