Quiz

Review today's material by taking this three-question quiz.

Questions

1:If a local variable has the same name as an instance variable, how can you refer to the instance variable in the scope of the local variable?
  1. You can't; you should rename one of the variables.

  2. Use the keyword this before the instance variable name.

  3. Use the keyword super before the name.

2:Where are instance variables declared in a class?
  1. Anywhere in the class

  2. Outside of all methods in the class

  3. fter the class declaration and above the first method

3:How can you send an argument to a program that includes a space character?
  1. Surround it with quotes

  2. Separate the arguments with commas

  3. Separate the arguments with period characters

Answers

A1: b. Answer (a) is a good idea, though; ...

Get Sams Teach Yourself Java 2 in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.