Unit 5: Writing Classes Flashcards
1
Q
void means methods ____.
A
don’t have a return value (will have error if no return and not specified as void)
2
Q
Static methods can ___.
Other methods can ___.
A
only access static variables
access and mutate static and regular variables
3
Q
Static method call in other class:
A
ClassName.methodName();
4
Q
Instance variables and local variables can have the same name without this, but ___.
A
then the variable just has the instance variable value, and it can look confusing
5
Q
You can’t declare variables as _____ inside of a method.
A
public or private
6
Q
how to call a static method in another class:
how to call a regular method:
A
className.objectName();
objectName.method();