Results 1 to 3 of 3

Thread: Incrementing

  1. #1
    csanch11 is offline Member
    Join Date
    Oct 2013
    Posts
    63
    Rep Power
    0

    Default Incrementing

    What is the difference between these two statements?

    ++freq;
    freq++;

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Incrementing

    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    radiodave is offline Member
    Join Date
    May 2015
    Posts
    15
    Rep Power
    0

    Default Re: Incrementing

    It's a pretty elementary question, and the answer is in the tutorials. Both increment the value of freq, but the difference is in an expression such as:

    Java Code:
    freq1 = freq++;
    freq1 has the value of freq before it is incremented.

    In the expression:

    Java Code:
    freq1 = ++freq;
    freq is incremented first, then assigned to freq1.

Similar Threads

  1. Incrementing variables
    By Minionfx in forum New To Java
    Replies: 5
    Last Post: 11-06-2012, 05:44 PM
  2. For Loop NOT Incrementing...
    By HSKrustofsky in forum New To Java
    Replies: 2
    Last Post: 09-04-2011, 11:13 PM
  3. Incrementing by more than 1
    By davidq23 in forum New To Java
    Replies: 2
    Last Post: 07-27-2011, 01:12 AM
  4. Help with incrementing numbers in a GUI
    By jdg951 in forum New To Java
    Replies: 6
    Last Post: 01-18-2011, 03:23 AM
  5. Incrementing and loops
    By Rubidoux in forum New To Java
    Replies: 1
    Last Post: 04-24-2010, 02:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •