New to Java? We'll help you get started with our revised beginner's tutorial, or our free online textbook.


Get the latest Java books
h t t p : / /w w w . j a v a c o f f e e b r e a k . c o m /

Java Coffee Break

Menu



Learning Java

Articles
Author Profiles
Lessons
FAQ's
Books
Newsletter
Tutorials
Talk Java!

Using Java

Applets
JavaBeans
Servlets
Resources
Discuss Java


Looking for Java resources? Check out the Java Coffee Break directory!

Sitting for the Sun Certification Exams

1. Which of the following is not a
   public method or instance variable of
   java.lang.String?

a) String.length
b) String.size
c) String.getLength()
d) String.length()

The only valid public method is String.length().

2. What keyword is used to specify a class
   variable?

a) final
b) public
c) static
d) private

The static keyword indicates a variable is shared by all instances of a class.

3. Which of the following are valid
   comment(s)?

a) / This is a comment
b) /* This is a comment */
c) (* This is a comment *)
d) // This is a comment

The two valid comment types are // and /* */. A third type /** */ indicates a javadoc comment.

4. Which of the following will not produce
   a compile-time error?

a) public class MyString extends
   java.lang.String
b) class MyClass implements
   java.io.Serializable
c) class NetworkClient

Sorry. That was a trick question. String is marked final, so it cannot be subclassed in a). Your must know your API very well to pass!

Back

Back to main


Copyright 1998, 1999, 2000 David Reilly

Privacy | Legal | Linking | Advertise!

Last updated: Monday, June 05, 2006