Question 2

d)  What will be the output for the following program segment?

int a=0,b=10,c=40;
a = - - b +c ++ +b;
System.out.println(“ a = “ + a); 
Answer:
a = 58
a= --b + c++ + b;
a= 9 + 40 +9
a=58

e) What are the difference between if else and switch case
This entry was posted in Term 2. Bookmark the permalink.

Leave a Reply

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