Test Your Knowledge on Framed

Quiz yourself to assess the knowledge you gained in the chapter.

1

Can you declare a method parameter with the same name as a previously defined integer instance variable?

For example:

private int x;
public void add(int x) {
A)

Yes, but when in the method you must refer to the instance variable as this.x.

B)

No, you must use unique variable names.

C)

Yes, but you cannot access the value of the instance variable from within the method.

D)

Yes, but when in the method, you must refer to the parameter as this.x.

Question 1 of 50 attempted

Get hands-on with 1200+ tech skills courses.