What is the result?

Given the code fragment:
int b = 4;

b — ;
System.out.println (– b);
System.out.println(b);
What is the result?

Given the code fragment:
int b = 4;

b — ;
System.out.println (– b);
System.out.println(b);
What is the result?

A.
2 2

B.
1 2

C.
3 2

D.
3 3

Explanation:
Variable b is set to 4.
Variable b is decreased to 3.
Variable b is decreased to 2 and then printed. Output: 2
Variable b is printed. Output: 2



Leave a Reply 3

Your email address will not be published. Required fields are marked *


HJ

HJ

Given the code fragment:
int b = 4;
b — ;
System.out.println (– b);
System.out.println(b);
What is the result?

Ans:A

Lasandra Diehl

Lasandra Diehl

I wish to show my appreciation to this writer just for bailing me out of such a dilemma. Right after checking throughout the world wide web and obtaining basics which were not productive, I was thinking my entire life was gone. Existing without the presence of solutions to the difficulties you’ve fixed by means of the posting is a critical case, as well as the ones which might have badly damaged my entire career if I had not noticed your blog post. The talents and kindness in touching everything was priceless. I don’t know what I would’ve done if I had not come upon such a stuff like this. It’s possible to at this moment look forward to my future. Thank you so much for this high quality and result oriented help. I won’t think twice to endorse the blog to anybody who needs and wants recommendations about this problem.

http://www.mHijKstarb.com/mHijKstarb