O'Reilly logo

Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition by Rolf W. Rasmussen, Khalid A. Mughal

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

Review Questions

4.8 Which one of these is a valid method declaration?

Select the one correct answer.

  1. void method1 { /* ... */ }

  2. void method2() { /* ... */ }

  3. void method3(void) { /* ... */ }

  4. method4() { /* ... */ }

  5. method5(void) { /* ... */ }

4.9 Given the following code, which statements can be placed at the indicated position without causing compilation errors?
public class ThisUsage {
    int planets;
    static int suns;
    public void gaze() {
        int i;
        // ... insert statements here ...
    }
}

Select the three correct answers.

  1. i = this.planets;

  2. i = this.suns;

  3. this = new ThisUsage();

  4. this.i = 4;

  5. this.suns = planets;

4.10 Given the following pairs of method declarations, ...

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