|
Yup, C syntax has some syntactical sugar that can make code hard to read. It is to bad that for marketing reasons Java kept almost all the syntax of C. For "fun" try these [hopefully I got them right]: With: int a = 3, b = 3; 1) System.out.println( "a++ is " + a++); 2) System.out.println( "++b is " + ++b); With: int a = 5, b = 0; 3) b= a++; 4) b = ++a; 5) a = --b; 6) a = b--; 7) (a+b)++; With: int a = 4, b = 2, c = 3; 8) c *= (a++ / b); Answers: 1) a++ is 3 2) ++b is 4 3) b is now 5 and a is now 6 4) b and a are now 7 5) a and b are now 6 6) a is now 6 and b is now 5 7) Is illegal! The ++ operator doesn't mean add one. It means add one to a variable. (a+b) is an expression. 8) c is now 6 and a is now 5; [Computes a/b, multiplies it with c, stores the answer in c; adds 1 to a] /Tim +--- | This is the JAVA/400 Mailing List! | To submit a new message, send your mail to JAVA400-L@midrange.com. | To subscribe to this list send email to JAVA400-L-SUB@midrange.com. | To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com. | Questions should be directed to the list owner: joe@zappie.net +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.