aspose file tools*
The moose likes Beginning Java and the fly likes serialization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "serialization" Watch "serialization" New topic
Author

serialization

Catherine austin
Ranch Hand

Joined: Jul 20, 2011
Posts: 43
Can any one please explain me what the following statements means. i came across it while studying serialization.
System.out.print( + + a.b + " ");

thanks in advance.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38851
    
  23
It means whoever wrote it is trying to confuse you. There is some very bad coding in that line. I think you have copied it wrongly, too, adding a space; it will only compile if you write ++, but + + will give you an error.
You need to look up the precedence of the operators: . > ++ and ++ > + and + > everything else because it is in brackets.
  • 1: Highest precedence . You are getting the "b" member of the object "a" (or the class "a" if it is static).
  • 2: Next down ++. You are applying the pre-increment operator to it, increasing its value by 1, so it will return 1 more than its previous value.
  • 3: + You are catenating the String object following, a single space.
  • 4: () The whole thing is now the argument to the print method.
  • I am sure you can work the rest out for yourself. I am also sure you would never write that sort of code yourself, and hope if you ever did you would be sacked (if an employee) or failed (if a student) on the spot
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: serialization