int a=1,b=10;
System.out.println(a+b--);

Answers were Sorted based on User's Feedback



int a=1,b=10; System.out.println(a+b--);..

Answer / jayaprakash

11

Is This Answer Correct ?    65 Yes 5 No

int a=1,b=10; System.out.println(a+b--);..

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

int a=1,b=10; System.out.println(a+b--);..

Answer / ramakrishna

Ans: 11

Is This Answer Correct ?    10 Yes 1 No

int a=1,b=10; System.out.println(a+b--);..

Answer / muthu krishna manian

11

Is This Answer Correct ?    4 Yes 0 No

int a=1,b=10; System.out.println(a+b--);..

Answer / abc

11

Is This Answer Correct ?    4 Yes 0 No

int a=1,b=10; System.out.println(a+b--);..

Answer / ravi ranjan

ANSWER=11

Is This Answer Correct ?    3 Yes 1 No

int a=1,b=10; System.out.println(a+b--);..

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

int a=1,b=10; System.out.println(a+b--);..

Answer / bikash

can u pls explain how ur answers are 11 and 1 11?

Is This Answer Correct ?    3 Yes 3 No

int a=1,b=10; System.out.println(a+b--);..

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

int a=1,b=10; System.out.println(a+b--);..

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

Post New Answer

More Core Java Interview Questions

Is java programming easy?

0 Answers  


Does java have a compiler?

0 Answers  


Does java arraylist maintain insertion order?

0 Answers  


How can we handle runtime exceptions? write one sample program? Can we write runtime exceptions beside the throws key word? if yes write sample program?

1 Answers   Huawei,


What is the difference between serializable and externalizable interface?

0 Answers  






which is advanced deep technology in java launched by the sun microsystem??? The answer is very logical If u need correct answer mail me at priya_gupta@gmail.com

0 Answers   IBM,


What is thread life cycle in java?

0 Answers  


Is array an object in java?

0 Answers  


Difference between comparator and comparable in java?

0 Answers  


Can we start a thread twice in java?

0 Answers  


Does set allows null in java?

0 Answers  


Explain how can you debug the Java code?

0 Answers   BirlaSoft,


Categories