Static variables and constants Flashcards
Static variable definition:
an attribute that belongs to a class as a whole, not to individual objects (instances) of that class. Such an attribute is represented by a variable called static variable or class, which is declared with the keyword static
Static methods (methods that do not involve any particular instances of a class) cannot access or modify any instance variables and cannot refer to _____, because _____ is undefined when a static method is running
this
When a parameter is passed by value, the method works with a copy of the variable passed to it, so it has no way of changing the value of the original. What will be returned by:
int x = 3, y = 5
fun(x, y)
System.out.println(x + “ “ + y)
3, 5
Note that no matter what fun(x, y) actually does, it will not affect the values of x and y because it is only working with a copy