Java Basics _ rows and columns of two-dimensional arrays

Source: Internet
Author: User

Tag: Code + + contains ring ATI Test int RGS

The two-dimensional array in Java is essentially a one-dimensional array, and a one-dimensional array containing sub-arrays forms a level two!

Sample code

 Packagejava_test; Public classArray_test { Public Static voidMain (string[] args) {int[] a= {{1,2,3},{2,3,4,5},{17,18,19,20,99,87}}; System.out.println ("The number of rows in array A is" +a.length);//to find the number of rows in an array         for(intI =0;i<a.length;i++) {System.out.println ("First" + (i+1) + "number of rows" +a[i].length);//How many columns are in each row of the array        }            }}

Java Basics _ rows and columns of two-dimensional arrays

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.