Object: Our rabbit ... thing Member variables: cute, scared, clumsy ... what is it like? Method: Sleep, eat, bounce, run ... how can you move?
public class Rabbit{
Int age; //Store member variable age
String personality; //Store member variable personality
void setAge(int newAge){
age = newAge;
}
Int getAge(){
return age;
}
}
Variables that can only be referenced in a limited range within the program
Variables declared inside a method cannot be referenced outside the method
Variables declared in if and for statements cannot be used outside the clause
Phrase: The smallest unit that divides a sentence into an actual language to the extent that it is not unnatural.
Variables declared as members of a class (member variables) cannot be referenced from outside the class.
Public class Variable{
Public static void main(String[] args){
String rabbit;
//Local variables that can only be referenced within the main method
}
}
I will add it when I come up with it.