O'Reilly logo

Java, A Beginner’s Guide, 5th Edition by Herbert Schildt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Image Chapter 4 Self Test

1. What is the difference between a class and an object?

2. How is a class defined?

3. What does each object have its own copy of?

4. Using two separate statements, show how to declare an object called counter of a class called MyCounter.

5. Show how a method called myMeth( ) is declared if it has a return type of double and has two int parameters called a and b.

6. How must a method return if it returns a value?

7. What name does a constructor have?

8. What does new do?

9. What is garbage collection, and how does it work? What is finalize( )?

10. What is this?

11. Can a constructor have one or more parameters?

12. If a method ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required