unexpected output

Discussion in 'Java' started by shyam_oec, Feb 24, 2008.

  1. shyam_oec

    shyam_oec New Member

    Joined:
    Nov 26, 2007
    Messages:
    89
    Likes Received:
    1
    Trophy Points:
    0
    Occupation:
    Software Developer, .NET Framework
    Location:
    Jamshedpur
    Code:
    class C
    {
      static int f1(int i)
      {
        System.out.print(i+",");
        return 0;
      }
    
    public static void main(String [] args)
      {
        int i=0;
        i=i+++f1(i);
        System.out.print(i);
      }
    }
    
    
    output of this code is 1,0
    plz explain how?
     
    Last edited by a moderator: Feb 25, 2008

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice