Syntax Quiz 2, Step 3
Assignment:
Insert the instance variable declaration into the class body.
My solution:
You've already written
class QuizClass
{
}
and
int instanceVar;
Now put them together as
public class QuizClass
{
private int instanceVar;
}
(Note that the public
and private
were considered optional for this quiz.)
Common mistakes:
- Putting the instance variable declaration in the wrong place.
- An instance variable declaration must appear inside a class body, but
not inside anything else (e.g. a method body).
Last modified:
Stephen Bloch / sbloch@adelphi.edu