# What is the output of the following program?

Class Test{
public static void main(String [] args){
int a=8;
a=--a+a--+a++;
System.out.println(a );
}}

Showing Answers 1 - 7 of 7 Answers

#### priyanka

• Jun 8th, 2016

20

Was this answer useful?  Yes

#### Sathyanath

• Jun 10th, 2016

int a=8
a=--a+a--+a++;
--a=a-1=8-1=7
a--=-1+a=-1=8=7
a++=a+1=8+1=9
a=--a+a--+a++=7+7+9=23

Was this answer useful?  Yes

#### ritu gupta

• Jun 14th, 2016

20

Was this answer useful?  Yes

#### @ritu

• Jun 15th, 2016

21
a=8
a=--a+a--+a++;
--a=7
a--=6
a++=7
first all the computations are done then the values is substituted for in expression from right to left
a=7+7+7=21

Was this answer useful?  Yes

#### shanga

• Jun 7th, 2017

What is byte of code in the context of Java?

Was this answer useful?  Yes

#### steven.mtl

• Jul 13th, 2017

20

Was this answer useful?  Yes

#### himanshu kumar singh

• Feb 14th, 2018

A=8;
--a=8-1=7; now a value is 7
a--=7-1=6; now a value is 6
a++=6+1=7; now a=7+6+7=20

```Codeint a=8;
a=--a+a--+a++;
System.out.println(a);```

Was this answer useful?  Yes

### Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.  