Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
master
Branches (1)
Tags (6)
master
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
master
Branches (1)
Tags (6)
master
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
master
Branches (1)
Tags (6)
master
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
learnjava
/
code
/
20171130Array
/
ArrayClass.java
learnjava
/
code
/
20171130Array
/
ArrayClass.java
ArrayClass.java 1.96 KB
Copy Edit Raw Blame History
番薯 authored 2017年11月30日 16:26 +08:00 . 1.0.4 添加demo:字符/字符串/数组
/*
必须声明数组变量,才能在程序中使用数组。声明数组变量的语法:
dataType[] arrayRefVar; // 首选的方法
或 dataType arrayRefVar[]; // 效果相同,但不是首选方法
*/
public class ArrayClass {
public static void main(String[] args) {
int[] ages;
ages = new int[10];
ages[0] = 10;
ages[9] = 30;
for (int age : ages) {
System.out.print(age + "\t");
}
System.out.println("");
int ages2[] = new int[100];
ages2[1] = 10;
ages2[4] = 30;
for (int age : ages2) {
System.out.print(age + "\t");
}
System.out.println("");
int[] ages3 = {1,3,9,5,6,6};
for (int age : ages3) {
System.out.print(age + "\t");
}
System.out.println("");
System.out.println("ages3 的大小:" + ages3.length);
System.out.println("ages3 第2个值:" + ages3[1]);
// public static int binarySearch(Object[] a, Object key) 用二分查找算法在给定数组中搜索给定值的对象(Byte,Int,double等)。数组在调用前必须排序好的。如果查找值包含在数组中,则返回搜索键的索引;否则返回 (-(插入点) - 1)。
// public static boolean equals(long[] a, long[] a2) 如果两个指定的 long 型数组彼此相等,则返回 true。如果两个数组包含相同数量的元素,并且两个数组中的所有相应元素对都是相等的,则认为这两个数组是相等的。换句话说,如果两个数组以相同顺序包含相同的元素,则两个数组是相等的。同样的方法适用于所有的其他基本数据类型(Byte,short,Int等)。
// public static void fill(int[] a, int val) 将指定的 int 值分配给指定 int 型数组指定范围中的每个元素。同样的方法适用于所有的其他基本数据类型(Byte,short,Int等)。
// public static void sort(Object[] a) 对指定对象数组根据其元素的自然顺序进行升序排列。同样的方法适用于所有的其他基本数据类型(Byte,short,Int等)。
}
}
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

Releases

No release

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/potato512/learnjava.git
git@gitee.com:potato512/learnjava.git
potato512
learnjava
learnJAVA
master
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /