aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes one more question on arrays only Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "one more question on arrays only" Watch "one more question on arrays only" New topic
Author

one more question on arrays only

chetna jain
Greenhorn

Joined: Nov 08, 2001
Posts: 6
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

Joined: Aug 26, 2001
Posts: 7610
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


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
chetna jain
Greenhorn

Joined: Nov 08, 2001
Posts: 6
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

Joined: Aug 26, 2001
Posts: 7610
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
 
subject: one more question on arrays only
 
Similar Threads
Statement Exceution
Mock Question Doubt...EQ+..Operators and Assignment
Exception Question.
How expression is working
expression evaluation