Chapter 2


  1. An instance variable is an attribute of a class.

  2. You determine the class size by adding the size of all its attributes.

  3. You declare an instance of a class by first reserving memory for the class using the new operator followed by the constructor of the class ( new RegistrationForm() ). Next, declare a reference to the class and give that reference a name ( RegistrationForm myRegistrationform ). Finally, assign a reference to the memory reserved for the class to the reference using an assignment statement.

  4. An instance variable is declared by specifying the data type of the variable, followed by the variable name, and ending with a semicolon within the body of a class definition.

  5. A data type is a keyword that tells the computer the kind of data you want to store in a memory location.

  6. A method definition consists of the name of a method, an argument list (if any), the data type of the value returned by the method, and the method body.

  7. Although some programmers consider an argument list and a parameter list to be the same thing, other programmers consider a parameter list to be values passed to a method when the method is called, and they consider an argument list to be values defined within the method definition that receive values passed to the method.

  8. A member method is called by first declaring an instance of a class and then using the name of the instance followed by the dot operator and the name of the method ” myInstance.myMethod() , for example.

  9. A constructor is a method of a class that is called automatically when an instance of a class is declared. A constructor is defined in the class and must have the same name as the class name. A class can have multiple constructors, each with a different argument list. The argument list is traditionally used with the constructor to initialize instance variables of the class.

  10. An instance variable is accessed by first declaring an instance of a class and then using the name of the instance followed by the dot operator and the name of the variable ” myInstance.myVariable , for example.




OOP Demystified
OOP Demystified
ISBN: 0072253630
EAN: 2147483647
Year: 2006
Pages: 130

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net