User Profile

Collapse

Profile Sidebar

Collapse
30081986
30081986
Last Activity: Nov 8 '07, 02:45 PM
Joined: Nov 2 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • 30081986
    replied to arrays in JAVA
    in Java
    Thanks for the reply..
    I have a small doubt..Since we are using the same 'i' as the index to access the array elements,should n't reflect back on the left hand side when the decrement operation is done on the right hand side..i.e we are using 'i' as the index to access the array elemts and 'i' becomes 2 first on the right side and the same 'i' becomes 1 on the left hand side ,so effectively i now has 1 and arr[i] is now arr[1] and hence it...
    See more | Go to post

    Leave a comment:


  • 30081986
    started a topic arrays in JAVA
    in Java

    arrays in JAVA

    Hello Everyone..
    The following code module is giving 13 as the answer in JAVA
    class Number
    {
    public static void main(string args[])
    {
    int arr[] = {4,8,16};
    int i = 1;
    arr[++i] = --i;
    System.out.prin tln(arr[0]+arr[1]+arr[2]);
    }

    I m getting the same output n c# as well...

    But the same code in c and c++ is giving the output as 21.It is as below......
    See more | Go to post
No activity results to display
Show More
Working...