COMP 202 Lecture Notes - Lecture 24: Amay

34 views2 pages
jc123 and 40170 others unlocked
COMP 202 Full Course Notes
100
COMP 202 Full Course Notes
Verified Note
100 documents

Document Summary

The final keyword: if we declare a variable as final, then the value of the variable can never be changed after it has been assigned. Constructors: a method that is called automatically when we create a new object instance, it must have the following form: The name of the constructor method must be the same as the name of class. In some sense it returns the new object that was just created. The this keyword: is used inside non-static methods to refer to the object on which the method was called, it allows the programmer to distinguish between class variables and local variables that have the same name. Array of objects: when using arrays of reference types, be extra careful to initialize all of the elements in the array before you try to access their properties, otherwise you will get a null-pointer exception o. The values are all 0s but they exist because there is the for loop.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions