File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Dim of Array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Dim of Array" Watch "Dim of Array" New topic
Author

Dim of Array

Girish Pandey
Greenhorn

Joined: Mar 29, 2007
Posts: 1
Q.What is the maximum number of dimensions an array can accept:
(a). 266
(b). 255
(c). 256
(d). 250
& Why .
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Moving to SCJD; can't imagine there's any other purpose for asking this.


[Jess in Action][AskingGoodQuestions]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40034
    
  28
An array can only accept a single dimension. Go through the Java Language Specification and look for section 10. There is no such thing as a multi-dimensional array in Java. And the same section will tell you the largest number of [] in arrays of arrays is 258.

There is a minor misprint in this posting. Find it yourself.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40034
    
  28
You might find more in the JVM specification. Try section 4.10.

Then tell everybody what you found.
Pravin Jain
Ranch Hand

Joined: May 20, 2007
Posts: 60
The maximum number of dimensions can be upto 255.


The Zen of Java Programming.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40034
    
  28
Please don't tell him the answer, Pravin Jain. I knew it's 255, you knew it's 255, now (he?) Giresh Pandey won't know how to find out things for himself, and will soon forget it's 255.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Originally posted by Ernest Friedman-Hill:
Moving to SCJD; can't imagine there's any other purpose for asking this.


It's not even a question that would be asked for SCJP 1.4/5.0 either.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dim of Array