English

Give the output of the following method: public static void main (String [] args) { int a = 5; a++; System.out.println(a); a -= (a--) − (--a); System.out.println(a); }

Advertisements

Question

Give the output of the following method:

public static void main (String [] args)
{
int a = 5;
a++;
System.out.println(a);
a -= (a--) − (--a); 
System.out.println(a);
}
One Line Answer
Advertisements

Solution

The output of this method is 6 and 4.

shaalaa.com
  Is there an error in this question or solution?
Chapter 1.04: Operators in Java - Review Insight [Page 42]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 1.04 Operators in Java
Review Insight | Q 4. | Page 42
Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×