Fichas
OOP - Instance and Static Variables
Fichas del conjunto (10)
- 1Local Variables What are they? What is there scope?Variables declared in the body of a method
No scope beyond the method they were declared in - 2Attempting to refer to variables beyond their scope will cause a _____ _____ errorcompile time
- 3Instance Variables What are they?Variables that are declared in the class NOT within a method
- 4What are getters and setters?2 methods that manipulate the attributes that belong to a particular object (or class)
- 5What is the general format of a "get()" method using an int as an example?public int getInt(){
return classInt;
} - 6What is the general format of a "set()" method using an int as an example?public void setInt(int age){
this.age = age;
} - 7Static Variables Every object has its own copy of all the instance variables of the class. "static" makes the variable _____constant
- 8Static Variables What is their scope?Class Wide
- 9Static Variables How can you access them from other classes? Given that the name of the class it resides in is called "Nathan" and the variable is called "age"Nathan.age;
- 10To use a static method in another class, does an object have to be instantiated? Can a "this" keyword be used in a static method?No
No
Información
- Descripción
- Masters Programming I Fichas sobre OOP - Instance and Static Variables, creado por nhunsdale02 el 05/06/2014.
- Creado por
- nhunsdale02
- Visitas
- 16
- Valoración