COMP 202 Lecture Notes - Lecture 23: Class Variable, For Loop, List Of Fables Characters

51 views9 pages
hwpark22 and 40159 others unlocked
COMP 202 Full Course Notes
100
COMP 202 Full Course Notes
Verified Note
100 documents

Document Summary

When we have a static attribute or method, it"s defined on the entire class. When you have a non-static attribute or method, it will be defined for a particular instance of the class, and not on the entire class. Eg: the length of a string is a non-static method, because it is defined on an instance, and not on the whole class. The this keyword refers 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. The this keyword will only ever be used in a non-static method, because it refers to a particular instance. If we declare a variable as final , then the value of the variable can never be changed after it has been assigned. If you try to change it, you get a compliler time error.

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