Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

one more question on arrays only

 
chetna jain
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class Test1
{
public static int[ ] getArray() { return null;
}

public static void main(String[] args)
{
int index = 1;
try
{
getArray()[index=2]++;
}
catch (Exception e){ } //empty catch
System.out.println("index = " + index);
}

}

i am not getting this question to what will be the output

pls help me out.

 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the following JLS link http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#23902 explains it all...
Happy reading
HIH
------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform
 
chetna jain
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not getting what they have written in the link u provided. i'll be grateful if u help me out in this question
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
maybe the following link will be better
http://java.sun.com/docs/books/tutorial/java/data/arrays.html
HIH
------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic