int a=1,b=10;
System.out.println(a+b--);
Answers were Sorted based on User's Feedback
Answer / shahsidhar
11
because b-- having post decrement operator that means
decrement operation will be done in the next statement i.e
after a+b-- statement execution.
| Is This Answer Correct ? | 22 Yes | 2 No |
Answer / mamitha
Ans.11 b'coz based on operator precedence rule, -- ll works first and we get 10 for b (post decrement) and it ll add with 1 .
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / bikash
can u pls explain how ur answers are 11 and 1 11?
| Is This Answer Correct ? | 3 Yes | 3 No |
Answer / amit
U see 'a' and 'b' are integer type so they will be added.
if it had been char then the answer would be 111.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / amit
@Nagesh
if we have:(a+(b--));
answer:11
if : ((a+b)--);
answer: 11;
if :(a+b--);
answer:11;
| Is This Answer Correct ? | 0 Yes | 0 No |
Explain how can you debug the Java code?
What are basic data types?
What is the difference between class & object?
Why we should declare the variables as static and final in interfaces?
my method "abc" return array of interface "xyz" and "pqr" is abstract class implements abc and class "jkl" extends pqr My problem 1) when i call abc it retrun array xyz how can i do this hint xyz refer_xyz = new jkl(); but i can't create array. 2)I want to access method of jkl using reference of xyz??
Can Java be said to be the complete object-oriented programming language
How java enabled high performance?
What are the ways to instantiate the class class?
Can a class with private constructor be extended?
What are the three types of design patterns?
What is the difference between sleep and wait in java?
Is linked list a linear or non-linear data structure?
0 Answers Akamai Technologies,