Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Learn a little Array of Scala every day

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

How to learn arrays? It can be considered from the following scheduling

1. You can create an array in the following ways:

Method 1: use new to create and scala to infer types automatically

Method 2: use new to create and add type declaration

Val b = new Array [Int] (10)

Method 3: do not use new, initialize the array when creating the array

Val placeName = Array ("beijing", "shanghai", "guangzhou")

Method 4: use range

2. Initialize the array

3. How do I access the elements in the array?

Access the elements of an array through an index

Println ("- >:\ t" + b (2)) / / unlike java, it is through parentheses.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report