• Register
0 votes
118 views

Problem :

java does not limit the number of dimensions that an array may have

6 5 3
6,930 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

The Java language does not limit the number of dimensions in an array but the Java VM spec limits the number of dimensions in an array to 255.

For example, the following code will fail to compile

class Main {
    public static void main(String[] args) {
        final int[][][][][][][][][][][][][][][][]
                 [][][][][][][][][][][][][][][][]
                 [][][][][][][][][][][][][][][][]
                 [][][][][][][][][][][][][][][][]
                 [][][][][][][][][][][][][][][][]
                 [][][][][][][][][][][][][][][][]
                 [][][][][][][][][][][][][][][][]
                 [][][][][][][][][][][][][][][][]
                 [][][][][][][][][][][][][][][][]
                 [][][][][][][][][][][][][][][][]
                 [][][][][][][][][][][][][][][][]
                 [][][][][][][][][][][][][][][][]
                 [][][][][][][][][][][][][][][][]
                 [][][][][][][][][][][][][][][][]
                 [][][][][][][][][][][][][][][][]
                 [][][][][][][][][][][][][][][][] x;
    }
}
with error

1.java:18: error: array type has too many dimensions
                 [][][][][][][][][][][][][][][][] x;
                                                  ^
1 error

9 7 4
38,600 points

Related questions

0 votes
1 answer 6 views
6 views
Problem: can someone please help for this problem? java limits the number of dimensions that an array may have to 15.
asked Apr 9 Rohit kr 17.5k points
1 vote
2 answers 608 views
608 views
Problem : I am beginner to numpy. I am trying to execute my code but I am facing below error. “Valueerror: all the input arrays must have same number of dimensions”. I want to have my all the arrays with a same shape. I am trying to fix above error from past couple of days but still unable to fix it. I am looking for some help in fixing above error.
asked Apr 4, 2020 morrisBson 3.2k points
0 votes
1 answer 2 views
2 views
Problem: I'm trying to solve this exercise of finding the number that appears an odd number of times in an array. I have this so far but the output ends up being an integer that appears an even number of times. For example, the number 2 appears 3 times and the number 4 appears 6 times, but the ... count = tempCount; element = array[j]; } } } } return element; } oddInt([1,2,2,2,4,4,4,4,4,4,5,5]);
asked May 3 muktaa 34.6k points
0 votes
1 answer 34 views
34 views
Problem: Please assist me in resolving this issue: find a pair of elements from an array whose sum equals a given number in java
asked Mar 29 tuhin1 48.9k points
1 vote
1 answer 9 views
9 views
Problem: I need a Java expert who could help ,me with this: Java program to find largest and smallest number in an array.
asked May 1 PkGuy 23.5k points
0 votes
0 answers 5 views
5 views
Problem: I will request someone to answer how to find the Java program minimum and maximum number in an array?
asked Apr 1 zayed1 61.8k points
1 vote
1 answer 16 views
16 views
Problem: After giving a code it does not display the minimum and miximum values» Java program to find minimum and maximum number in an array.
asked Mar 30 PkGuy 23.5k points
0 votes
1 answer 3 views
3 views
Problem: After runing this code I got this. Perl number of elements in an array.
asked Mar 22 PkGuy 23.5k points
0 votes
1 answer 2 views
2 views
Problem: I need someone’s assistance to solve my problem .. How to find missing number in array of 1 to 100 in java
asked 4 days ago Ifra 37.2k points