Type in your answers to each of these questions in a file named
prelab06.txt
in your Prelab Questions
directory. Turn in your answers before the
beginning of your laboratory session.
Question #1: To prevent the attributes of a class from being accessed directly by programs using the class, they are declared with ____________ visibility.
Question #2: The methods of a class provide a means by which the ____________ of a class object can be performed.
Question #3: A method that initializes a class object when that object is created is called a ____________.
Question #4: A method that returns an attribute of an object is called an ____________.
Question #5: A method that changes the state of an object is called a ____________.
Consider this class declaration:
public class Foo { private int myAaa; private double myBbb; public void Foo(int aaa, double bbb) { myAaa = aaa; myBbb = bbb; } }
Code #1: What is the name of this class?
Code #2: List the instance variables of this class.
Code #3: What's wrong with the constructor for the class?
Code #4: Write an accessor for the integer attribute of the class.