Answer is A.
To test:
public static void main(String[] args) {
int i = 10;
int j = 20;
int k = (j += i)/ 5;
System.out.println(i + " : " + j + " : " + k);
}
The correct answer is letter A. This is a type of question that you should be very careful about. Because in the instantiation line of the variable "k" there is a parenthesis an operation that changes the variable "j" (20) adding the value of "i" (10) making the new value of "j" to 30, as it is between parenthesis it adds the value to the variable K and then divides it by 5. If you have doubts, I also tested the code, it is here:
public static void main(String[] args) {
int i = 10;
int j = 20;
int k = (j += i) / 5;
System.out.print(i + ":" + j + ":" + k);
}
}
upvoted 3 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
MPignaProTech
2 months, 4 weeks agoakbiyik
2 years, 1 month agocarloswork
2 years, 2 months agoiSnover
2 years, 3 months ago