Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
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 The Software Craftsman this week in the Agile 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
 
Have you tried LearnNowOnline? http://www.learnnowonline.com/
 
subject: one more question on arrays only