in java 1.An alias is when Select one: two different reference variables refer t
ID: 3842712 • Letter: I
Question
in java
1.An alias is when
Select one:
two different reference variables refer to the same object.
two different primitive variables refer to the same value.
two different primitive variables contain identical values.
two variables have the same name.
any of the above
none of the above
Question text
2.What is stored in n after invoking the change method?
int n=3;
change(n );
// what does n store now?
public void change(int number) {
number++;
}
Answer:
3.What is stored in nums[0] after invoking the change method below?
int[] nums = {1, 2, 3};
change(nums);
// what does nums[0] store now?
public void change(int[] numbers) {
numbers[0]++;
}
Answer:
4.Use the following partial classes for the next 2 questions.
public class A1 {
public int a;
private int b;
protected int c;
public A1(int a, int b, int c) {
this.a = a;
this.b = b;
this.c = c;
}
}
public class A2 extends A1 {
protected int q;
private int r;
}
public class A3 extends A2{
private int m;
...
}
Which of the following instance data variables can be directly accessed inside class A2?
Select one or more:
a
b
c
q
r
m
Which of the following instance data variables can be directly accessed inside class A3?
Select one or more:
a
b
c
q
r
m
Explanation / Answer
1. two different reference variables refer to the same object.
2. 3
3. 2
4. a,c,q,r
5. a,c,q,m
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.