In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article shares with you the content of the sample analysis of the java array. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Java array
1) form of declaration:
Type [] arrayName; recommendation method
Type arrayName []
2) initialization: method 1: type [] arrayName;arrayName = new type [] {element1, element2, element3,...} method 2: type [] arrayName = {element1, element2, element3,...} method 3: report an error type [] arrayName;arrayName = {element1, element2, element3,...} mode 4: type [] arrayName = new type [length] Description: in mode 4, the system assigns initial values to array elements, such as byte,int long-> 0, float,double-> 0, boolean-> false, and reference type-> null. Do not specify the length of the array when initializing the array, but assign an initial value to each element. The array length is an attribute of the array, arrayName.length, which can be accessed. Foreach loop method: for (type var: array | collection) {.} Note: in this method, var is only a copy of the original collection. Modifying var will not change the content of the original collection. 3) Multidimensional array type [] [] arrName = new type [length] []; / / you can only specify high-dimensional type [] [] arrName = new type [length2] [length3]; String [] [] str1 = new String [] [] {new String [3], new String [] {"hello"}} / / visible low-dimensional lengths can be unequal 4) manipulate array tools such as ArraysbinarySearch, copyOf, sort, toString, etc. (supplementary use cases) Thank you for reading! This is the end of this article on "sample Analysis of java Array". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.