solutions graded A+ latest update to pass updated
1. What is
It is an interface that has only one abstract method
java.util.func-
(among other non-abstract methods) with the signature
tion.Predicate?
public boolean test(T t).
2. True or False: A
True
method with no ac-
An Overriding method is allowed to make the overridden
cess modifier
method more accessible, and since protected is more
defined in a class
accessible than default (pack- age), this is allowed. Note that
can be over- ridden
protected access will allow access to the subclass even if the
by a method
subclass is in a ditterent package but package access will not.
marked protected
(as- suming that it
is not fi- nal) in the
sub class. False
The break statement is to break out of any loop completely. So the
3. True or False:
current
Using a break in
a while
loop causes the loop to iteration and any other remaining iterations of the loop will no
execute.
break the current itera- Control is transferred to the first statement after the loop.
tion and start the
next iteration of
the loop.
4. What class of something about scope.
objects can be
declared by the
throws clause?
6. Which class should you use to
represent just a
5. Tell me
, Java Developer OCA Questions with complete
solutions graded A+ latest update to pass updated
E
x
c
e
p
t
i
o
n
E
r
r
o
r
RuntimeException
You can declare anything that is a
Throwable or a subclass of
Throwable, in the throws clause.
"class level" means static fields and
they can be accessed from
anywhere (i.e. static as well as non-
static methods) in the class (and
from outside the class depending
on their accessibility).
"instance level" means the instance
fields and they can be accessed
only from instance methods in the
class.
,Java Developer OCA Questions with complete
solutions graded A+ latest update to pass updated
date without any java.time.LocalDate
time- zone Java 8 introduces a new package java.time to deal with dates. The
information? old classes such as java.util.Date are not recommended
anymore.
7. A try statement catch, finally or both
must always have a
............. associated
with it.
No. The String class has no reverse( ) method but StringButter
8. Does the String (and StringBuilder) do have this method.
class have a
reverse method?
Fields in an interface are implicitly public, static and final. Although
9. Tell me something you
about fields in an inter- can put these words in the interface definition, it is not a good
practice
face. to do so.
10. What happens When you call System.exit(...); The JVM exits so there is no way to
when you call execute the finally block.
System.exit(0) in a
try block followed
by a finally block?
Java has only the following primitive data types:
11. What are the boolean, byte, short, char, int, long, float and double.
primitive data
types?
12. What is the correct dec- abstract public void add() throws Exception;
laration for an
abstract method
'add' in a class that
, Java Developer OCA Questions with complete
solutions graded A+ latest update to pass updated
is accessible to any
class, takes no ar-
guments and
returns nothing?
13.