This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Another question about Array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Another question about Array" Watch "Another question about Array" New topic
Author

Another question about Array

Wu Wen
Greenhorn

Joined: Oct 14, 2011
Posts: 27


Why it prints out index = 2 instead of throwing an exception at //1 ?
Nitin Surana
Ranch Hand

Joined: Jan 21, 2011
Posts: 129

It throws an exception, but you have already caught that.

Wu Wen wrote:



Javin Paul
Ranch Hand

Joined: Oct 15, 2010
Posts: 281

why are you coding like that, what do you want to test ?


http://javarevisited.blogspot.com - java classpath - Java67 - java hashmap - java logging tips java interview questions Java Enum Tutorial
O. Ziggy
Ranch Hand

Joined: Oct 02, 2005
Posts: 430

What exactly does this line do..

Abdullah Mamun
Ranch Hand

Joined: Mar 19, 2007
Posts: 99

1. method getArray() is called.
2. index variable set with value 2.
3. trying to fetch the value of 2nd index of the array that returned by getArray() method which is null and exception occurs.


MooN
O. Ziggy
Ranch Hand

Joined: Oct 02, 2005
Posts: 430

Thanks
 
Consider Paul's rocket mass heater.
 
subject: Another question about Array
 
Similar Threads
Exception Question.
one more question on arrays only
Code execution flow
Confuse
How expression is working