• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

arrays

 
maggie karve
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good Question.

Answer is 5.

because object o is storing five arrays of String.
 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
still not clear....
 
Neha Daga
Ranch Hand
Posts: 504
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you remember we discussed it once.
 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when did we discuss it?
 
Neha Daga
Ranch Hand
Posts: 504
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
while chatting.
 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh ya...we did...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic