Java Exam UPDATED ACTUAL Exam Questions and CORRECT
Answers
Consider the abstract superclass below:
public abstract class Fooo
{
private int a;
public int b;
public Foo(int aVal, intbVal) { a = aVal; b = bVal; }
public abstract int calculate();
}
Any concrete subclass that extends class Foo: - Must implement a method called calculate AND
will not be able to access the instance variable 'a'
How many times is the body of the loop below executed?
int counter = 1;
while (counter > 20) { ... } - 0 times
Which of the following statements about try blocks is true? - The try should contain statements
that may throw an exception
Which of the following is not true of ExecutorService? - That it is an object that can be run in a
separate thread
Static class variables: - are shared by all objects of a class
A _____ enables a program to read data from the user - Scanner
Answers
Consider the abstract superclass below:
public abstract class Fooo
{
private int a;
public int b;
public Foo(int aVal, intbVal) { a = aVal; b = bVal; }
public abstract int calculate();
}
Any concrete subclass that extends class Foo: - Must implement a method called calculate AND
will not be able to access the instance variable 'a'
How many times is the body of the loop below executed?
int counter = 1;
while (counter > 20) { ... } - 0 times
Which of the following statements about try blocks is true? - The try should contain statements
that may throw an exception
Which of the following is not true of ExecutorService? - That it is an object that can be run in a
separate thread
Static class variables: - are shared by all objects of a class
A _____ enables a program to read data from the user - Scanner