Answer is A.
Here is the source code to test:
public static void main(String[] args) {
int x = 100;
int a = x++; //x++ makes x=101 but returns old value so a =100
int b = ++x;// ++x makes x=102 and returns new value so b=102
int c = x++;//x++ makes x=103 but returns old value so c =102
int d = (a < b) ? (a < c) ? a:(b < c) ? b : c : x;
//a<b=true-->(a<c)=true-->d=a
System.out.println(d);
}
Answer is A.
Here is the source code to test:
public static void main(String[] args) {
int x = 100;
int a = x++;
int b = ++x;
int c = x++;
int d = (a < b) ? (a < c) ? a:(b < c) ? b : c : x;
System.out.println(d);
}
upvoted 1 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.
RoxyFoxy
Highly Voted 2 years, 3 months agovic88
Most Recent 1 week, 6 days agoSkytrix
1 year, 2 months agoSkytrix
1 year, 2 months agoarjunrawatirissoftware
1 year, 2 months agosushmitvawal
1 year, 3 months agoduydn
1 year, 3 months agoKolodets
1 year, 7 months agoVicky_65
1 year, 8 months agoAnkit1010
1 year, 10 months agohaisaco
1 year, 11 months agocarloswork
2 years, 1 month ago