5.11. Unit 5 Summary¶
5.11.1. Concept Summary¶
Class - A class defines a type and is used to define what all objects of that class know and can do.
Compiler - Software that translates the Java source code (ends in .java) into the Java class file (ends in .class).
Compile time error - An error that is found during the compilation. These are also called syntax errors.
Constructor - Used to initialize fields in a newly created object.
Field - A field holds data or a property - what an object knows or keeps track of.
Java - A programming language that you can use to tell a computer what to do.
Main Method - Where execution starts in a Java program.
Method - Defines behavior - what an object can do.
Object - Objects do the actual work in an object-oriented program.
Syntax Error - A syntax error is an error in the specification of the program.
5.11.2. Java Keyword Summary¶
class - used to define a new class
public - a visibility keyword which is used to control the classes that have access. The keyword public means the code in any class has direct access.
private - a visibility keyword which is used to control the classes that have access. The keyword private means that only the code in the current class has direct access.
5.11.3. Vocabulary Practice¶
-
5-11-1: Drag the definition from the left and drop it on the correct concept on the right. Click the "Check Me" button to see if you are correct
Review the summaries above.
- does the actual work in an object-oriented program.
- object
- defines a type
- class
- A programming language that you can use to tell a computer what to do.
- Java
- Translates a Java source file (ends in .java) into a Java class file (ends in .class)
- compiler
-
5-11-2: Drag the definition from the left and drop it on the correct concept on the right. Click the "Check Me" button to see if you are correct.
Review the summaries above.
- initializes the fields of an object after it has been created
- constructor
- defines behavior
- method
- holds data or a property
- field
- where execution starts
- main method
For more practice, see this Quizlet.
5.11.4. Common Mistakes¶
Forgetting to declare an object to call its methods.
Forgetting to write get/set methods for private instance variables.
Forgetting to write a constructor.
Mismatch in name, number, type, order of arguments and return type between the method definition and the method call.
Forgetting data types for every argument in the method definition.
Forgetting to use what the method returns.