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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Static methods can ___.
Other methods can ___.

A

only access static variables
access and mutate static and regular variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Static method call in other class:

A

ClassName.methodName();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

You can’t declare variables as _____ inside of a method.

A

public or private

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

how to call a static method in another class:
how to call a regular method:

A

className.objectName();

objectName.method();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly