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


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

arrays

maggie karve
Ranch Hand

Joined: Dec 29, 2009
Posts: 186
public class ID
{
public static void main(String... args)
{
Object [] object = new String[5][5];
int counter=0;
for (Object o : object )
{
counter++;
}
System.out.println(counter);
}
}

Choose: 1

Options

1.) 25

2.) 5

3.) 20

4.) Runtime error

5.) Compile error

Rajiv Chopra
Ranch Hand

Joined: Dec 19, 2008
Posts: 62
Good Question.

Answer is 5.

because object o is storing five arrays of String.

Rajeev Kumar
SCJP 6.0 Certified 96%
Raju Champaklal
Ranch Hand

Joined: Dec 10, 2009
Posts: 521
still not clear....


scjp 1.6 91%, preparing for scmad
"Time to get MAD now.. we will get even later"....by someone unknown
Neha Daga
Ranch Hand

Joined: Oct 30, 2009
Posts: 504
If you remember we discussed it once.


SCJP 1.6 96%
Raju Champaklal
Ranch Hand

Joined: Dec 10, 2009
Posts: 521
when did we discuss it?
Neha Daga
Ranch Hand

Joined: Oct 30, 2009
Posts: 504
while chatting.
Raju Champaklal
Ranch Hand

Joined: Dec 10, 2009
Posts: 521
oh ya...we did...
 
wood burning stoves
 
subject: arrays