• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

OCA 8 Chapter 2, page 59 example code snippet  RSS feed

Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have a question regarding the following code snippet solution on page 59 ( ch 2):

              int x = 3;
     int y = ++x * 5 / x-- + --x ;
     System.out.println( "x is" +x );
                     System.out.println( "y is" +y );

According to table 2.1 Order of precedence, post-unary operators are applied first, followed by pre-unary.
But in the above example, the first x with pre-unary operator is incremented and returned to the expression.

What am i missing here? Can someone point me in the right direction please.

a fool thinks himself to be wise, but a wise man knows himself to be a fool - shakespeare. foolish tiny ad:
global solutions you can do in your home or backyard
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!