It's not a secret anymore!
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

Another question about Array

Wu Wen

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: 294

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

SQL Query Interview Question
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.

O. Ziggy
Ranch Hand

Joined: Oct 02, 2005
Posts: 430

I agree. Here's the link:
subject: Another question about Array
jQuery in Action, 3rd edition