?? exercise9_9.java
字號:
/**
* Title: Chapter 1, "Introduction to Java and JBuilder"
* Description: Examples for Chapter 1
* Copyright: Copyright (c) 2000
* Company: Armstrong Atlantic State University
* @author Y. Daniel Liang
* @version 1.0
*/
import java.util.Date;
public class Exercise9_9 {
static int i;
public Exercise9_9() {
}
public static void main(String[] args) {
String[] strings = {"CS", "Math", "Biol", "Chem", "Phys", "Buss",
"Law", "Educ", "Elec Engr", "Mech Engr"};
Integer[] list = new Integer[10];
Date[] dates = new Date[10];
for (int i = 0; i < list.length; i++)
list[i] = new Integer((int)(Math.random() * 100));
for (int i = 0; i < list.length; i++)
dates[i] = new Date();
System.out.println("Max string is " + max(strings));
System.out.println("Max integer is " + max(list));
System.out.println("Max circle is " + max(dates));
}
public static Object max(Object[] a) {
Comparable max = (Comparable)a[0];
for (int i = 1; i < a.length; i++)
if (max.compareTo(a[i]) < 0)
max = (Comparable)a[i];
return max;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -