Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Java Operator precedence

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Location
    London
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java Operator precedence

    Hi again guys,

    having some difficulty with this question :

    What does this code block print? Explain your answer using the Java
    operator precedence table.

    int x = 5;
    int y = 10;
    int z = ++x * y--;
    System.out.println(x + ", " + y + ", " + z);

    I don't really understand...would appreciate any help...thanks guys!


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,254
    My Mood
    Hungover
    Thanks
    142
    Thanked 617 Times in 528 Posts

    Default Re: Java Operator precedence

    What happened when you put together an SSCCE that tested this out?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Nov 2012
    Location
    London
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java Operator precedence

    I haven't done that. I'm a beginner with Java, not great with it :$

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,254
    My Mood
    Hungover
    Thanks
    142
    Thanked 617 Times in 528 Posts

    Default Re: Java Operator precedence

    Quote Originally Posted by AnilS23 View Post
    I haven't done that. I'm a beginner with Java, not great with it :$
    Well, now you have your next step: put together a simple program and test out what happens.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. meaning of operator ( |= )
    By ashish12169 in forum Java Theory & Questions
    Replies: 1
    Last Post: July 18th, 2012, 02:05 AM
  2. Operator || cannot be applied to java.lang.String, boolean
    By djl1990 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: October 25th, 2011, 06:00 PM
  3. Error with OR operator
    By tarkal in forum Loops & Control Statements
    Replies: 3
    Last Post: September 4th, 2011, 02:49 PM
  4. about Operator Precedence
    By degar in forum Java Theory & Questions
    Replies: 6
    Last Post: August 12th, 2011, 01:57 AM
  5. Operator % cannot be applied to java.lang.String,int?
    By javarum in forum Java Theory & Questions
    Replies: 8
    Last Post: July 12th, 2011, 08:06 PM