How does Java define a two-dimensional array?

Source: Internet
Author: User
Tags array definition
You can also initialize a two-dimensional array definition array using [] [] in Java

Here are some examples
Float[][] Numthree; Defines a 2-dimensional array of type float
Numthree=new float[5][5]; Allocate 5 rows and 5 columns to the space size
numthree[0][0]=1.1f; Access 1 rows and 1 columns through the subscript index =1.1
Long[][] Numfive=new long[5][]; Defines a long type of irregular array
Numfive[0]=new long[5]; Assign 5 columns to line 1th
Defines an array of type Double assigns 3 rows and 3 columns of space at the same time to assign values
Double[][] numsix={{1.111d,2.222d,3.333d},{4.444d,5.555d,6.666d}};

Int[][] Numseven=new int[][]{{10,20,30},{40,50},{60}};

How does Java define a two-dimensional array?

Related Article

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.