11
answers
0
watching
354
views
30 Apr 2018
2. In this section you will be shown several classes. Inside the code for each class will be a question. You should provide your answer to the question inside the chart. Many of the questions will ask you whether a variable has changed or not. In cases that the variable being asked about is a primitive type, you should provide your answer based on the data stored in the primitive type. In cases that the variable being asked about is a reference type, you should provide your answer based on the data stored at the Object linked to by the reference type. For example, in the first snippet, the question asks about the variable x defined in the main method. Since x is a primitive type, you should answer YES if you think the variable x has had its value changed after the method methodOne() returns. All your answers should go in the chart below: (9 points) Part Answer to question x changed (circle one)? YES NO y changed (circle one)? a changed (circle one)? b changed (circle one)? d1 a changed (circle one)? b changed (circle one)? YES e words changed (circle one)? YES NO Values in array of array referred to by y: What is printed to the screen? (a) public class ReferenceTesti public static void methodOne (int x){ x++; public static void main(String[args) { int x = 0; methodOne (x); //IS THE DATA STORED OR REFERRED TO BY X THE SAME? (ANSWER IN CHART)
2. In this section you will be shown several classes. Inside the code for each class will be a question. You should provide your answer to the question inside the chart. Many of the questions will ask you whether a variable has changed or not. In cases that the variable being asked about is a primitive type, you should provide your answer based on the data stored in the primitive type. In cases that the variable being asked about is a reference type, you should provide your answer based on the data stored at the Object linked to by the reference type. For example, in the first snippet, the question asks about the variable x defined in the main method. Since x is a primitive type, you should answer YES if you think the variable x has had its value changed after the method methodOne() returns. All your answers should go in the chart below: (9 points) Part Answer to question x changed (circle one)? YES NO y changed (circle one)? a changed (circle one)? b changed (circle one)? d1 a changed (circle one)? b changed (circle one)? YES e words changed (circle one)? YES NO Values in array of array referred to by y: What is printed to the screen? (a) public class ReferenceTesti public static void methodOne (int x){ x++; public static void main(String[args) { int x = 0; methodOne (x); //IS THE DATA STORED OR REFERRED TO BY X THE SAME? (ANSWER IN CHART)
marcusnicole284Lv10
16 Jun 2023
Already have an account? Log in
gloryolalere280Lv10
20 Nov 2022
Already have an account? Log in
papayaprofessorLv10
5 Sep 2022
Already have an account? Log in
26 Jun 2022
Already have an account? Log in
Patrina SchowalterLv2
1 May 2018
Already have an account? Log in