testclass.java
来自「Java学习源代码检索系统免费版」· Java 代码 · 共 42 行
JAVA
42 行
//==============================================================
// TestClass.java - Submodule for ArrayCopy program
//
// Java学习源代码检索系统 Ver 1.0 20031015 免费正式版
// 版权所有: 中国IT认证实验室(www.ChinaITLab.com)
// 程序制作: ChinaITLab网校教研中心
// 主页地址: www.ChinaITLab.com 中国IT认证实验室
// 论坛地址: bbs.chinaitlab.com
// 电子邮件: Java@ChinaITLab.com
//==============================================================
class TestClass {
public static void CompareArrays(int apples[], int oranges[])
{
// Display the array values
int i;
System.out.print("apples : ");
for (i = 0; i < apples.length; i++)
System.out.print(apples[i] + " \t");
System.out.print("\noranges: ");
for (i = 0; i < oranges.length; i++)
System.out.print(oranges[i] + " \t");
System.out.println(); // Start new line
// Test if the array references are the same
if (apples == oranges)
System.out.println("Array references are identical");
else
System.out.println("Array references are NOT identical");
// Test if the array contents are the same
boolean identical = true;
for (i = 0; i < apples.length; i++)
if (apples[i] != oranges[i])
identical = false;
if (identical)
System.out.println("Array contents are the same");
else
System.out.println("Array contents are NOT the same");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?