wood burning stoves 2.0*
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
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Another question about Array