Problems in Java array subscript __java

Source: Internet
Author: User

Problem with Java array subscript out of bounds:

These problems have been occurring recently: array subscript out of bounds

An example is provided:

Exception in thread ' main ' java.lang.arrayindexoutofboundsexception:10 at
	day07. Paixu.get3max (rankdemo2.java:15) at
	day07. Rankdemo2.main (rankdemo2.java:54)
means that

there are many reasons why this type of problem occurs in line 15th. To sum up what I understand, the length of an array determines the amount of data it can load. and the
array count is zero-based,
for example: When Srring arr[]==new string[6], you can enter only six if you want to enter a name. More is the subscript out of bounds.
In addition, the array is generally used in conjunction with the For loop, so use the time to pay attention to its cyclic conditions.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.