Review of the Vehicle Class - why doesn't this class do anything when we click Run?
Creating a Driver (Test) Class for the Vehicle Class
Complete Section 4: Lesson 2 - Object and Driver Classes slides
Add comments to your code that explains what each line does.
Complete the practice questions and code. Demonstrate the Student, StudentTester, Person and ManagingPeople classes.
Section 4: Lesson 2 - Object and Driver Classes Vocabulary:
- A group of related Java classes.
-
Sections of code that are enclosed inside a set of curly braces. {}
-
First letter uppercase and the first letter of each internal word capitalized. Example: SavingsAccount
-
A named value that does not change.
-
First letter lowercase and the first letter of each internal word capitalized. Example: studentFirstName - A class that contains a main method.
-
A code statement in a Java class file that includes java code from another package or class.
-
A class that defines instances of objects to be used in another class.
-
Code that is preceded by //. Comments are used to clarify programming logic. Comments are ignored by the compiler.
-
A word that has a special function in the Java language, and cannot be used as names for classes, methods, or variables.
-
The library of Java classes available to import into a programmer-created class.
-
The outline of an object, including class variables, constructors, and methods.
-
A special kind of method that is a template for an object.
-
Values that are sent into a method or constructor to be used in a calculation or substituted with values from the class.
-
Values, such as numbers, characters, or booleans. References to objects, such as a BankAccount object. - Keywords used to specify the accessibility of a class (or type) and its members. Ex: public, private, protected, default
-
A block of code inside a class that is used to change or access information about the class.
Code Blocks format - just like an essay format { }
Programmer Created Classes - no main method - will NOT run, must be called by another class - a Driver class
The Driver (Test) class has a main method and within that main method it calls the methods of the programmer created class.
BOTH files must be in the same package to work!
Accessor/getter and Mutator/setter methods
- required so the Driver Class can access the data in the Object Class.
Java Key Words and camelCase
Variable names are short but meaningful in lower
camel case.
• Constant names are declared in uppercase letters with
the final modifier.
• Constructors are named the same as the class name.
• Methods are verbs named in lower camel case.