Skip to content

Commit 15afd31

Browse files
committed
Encoding other Java file to UTF8
1 parent 32cdfa8 commit 15afd31

File tree

182 files changed

+842
-842
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+842
-842
lines changed

example/CH10/AssertionDemo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public static void main(String[] args) {
55
}
66
else {
77
assert args.length == 0;
8-
System.out.println("¨S¦³¿é¤J¤Þ¼Æ");
8+
System.out.println("沒有輸入引數");
99
}
1010
}
1111
}

example/CH10/CatchWho.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ public static void main(String[] args) {
77
catch(ArrayIndexOutOfBoundsException e) {
88
System.out.println(
99
"ArrayIndexOutOfBoundsException" +
10-
"/¤º¼htry-catch");
10+
"/內層try-catch");
1111
}
1212

1313
throw new ArithmeticException();
1414
}
1515
catch(ArithmeticException e) {
16-
System.out.println("µo¥ÍArithmeticException");
16+
System.out.println("發生ArithmeticException");
1717
}
1818
catch(ArrayIndexOutOfBoundsException e) {
1919
System.out.println(
2020
"ArrayIndexOutOfBoundsException" +
21-
"/¥~¼htry-catch");
21+
"/外層try-catch");
2222
}
2323
}
2424
}

example/CH10/CatchWho2.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ public static void main(String[] args) {
77
catch(ArithmeticException e) {
88
System.out.println(
99
"ArrayIndexOutOfBoundsException" +
10-
"/¤º¼htry-catch");
10+
"/內層try-catch");
1111
}
1212

1313
throw new ArithmeticException();
1414
}
1515
catch(ArithmeticException e) {
16-
System.out.println("µo¥ÍArithmeticException");
16+
System.out.println("發生ArithmeticException");
1717
}
1818
catch(ArrayIndexOutOfBoundsException e) {
1919
System.out.println(
2020
"ArrayIndexOutOfBoundsException" +
21-
"/¥~¼htry-catch");
21+
"/外層try-catch");
2222
}
2323
}
2424
}

example/CH10/CheckArgsDemo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
public class CheckArgsDemo {
22
public static void main(String[] args) {
33
try {
4-
System.out.printf("°õ¦æ %s ¥à%n", args[0]);
4+
System.out.printf("執行 %s 功能%n", args[0]);
55
}
66
catch(ArrayIndexOutOfBoundsException e) {
7-
System.out.println("¨S¦³«ü©w¤Þ¼Æ");
7+
System.out.println("沒有指定引數");
88
e.printStackTrace();
99
}
1010
}

example/CH10/CheckedExceptionDemo.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ public static void main(String[] args) {
55
try {
66
BufferedReader buf = new BufferedReader(
77
new InputStreamReader(System.in));
8-
System.out.print("請輸入整數: ");
8+
System.out.print("請輸入整數: ");
99
int input = Integer.parseInt(buf.readLine());
1010
System.out.println("input x 10 = " + (input*10));
1111
}
1212
catch(IOException e) {
13-
System.out.println("I/O錯誤");
13+
System.out.println("I/O錯誤");
1414
}
1515
catch(NumberFormatException e) {
16-
System.out.println("輸入必須為整數");
16+
System.out.println("輸入必須為整數");
1717
}
1818
}
1919
}

example/CH10/ExceptionDemo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
public class ExceptionDemo {
44
public static void main(String[] args) {
55
try {
6-
throw new ArithmeticException("¨Ò¥~´ú¸Õ");
6+
throw new ArithmeticException("例外測試");
77
}
88
catch(Exception e) {
99
System.out.println(e.toString());

example/CH10/ExceptionDemo2.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
public class ExceptionDemo2 {
44
public static void main(String[] args) {
55
try {
6-
throw new ArithmeticException("¨Ò¥~´ú¸Õ");
6+
throw new ArithmeticException("例外測試");
77
}
88
catch(ArithmeticException e) {
99
System.out.println(e.toString());

example/CH10/ThrowDemo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ public class ThrowDemo {
22
public static void main(String[] args) {
33
try {
44
double data = 100 / 0.0;
5-
System.out.println("浮點數除以零:" + data);
5+
System.out.println("浮點數除以零:" + data);
66
if(String.valueOf(data).equals("Infinity"))
7-
throw new ArithmeticException("除零例外");
7+
throw new ArithmeticException("除零例外");
88
}
99
catch(ArithmeticException e) {
1010
System.out.println(e);

example/CH10/ThrowsDemo.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ public static void main(String[] args) {
44
throwsTest();
55
}
66
catch(ArithmeticException e) {
7-
System.out.println("捕捉例外");
7+
System.out.println("捕捉例外");
88
}
99
}
1010

1111
private static void throwsTest()
1212
throws ArithmeticException {
13-
System.out.println("這只是一個測試");
14-
// 程式處理過程假設發生例外
13+
System.out.println("這只是一個測試");
14+
// 程式處理過程假設發生例外
1515
throw new ArithmeticException();
1616
}
1717
}

example/CH11/DetailAction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ public enum DetailAction {
44
public String getDescription() {
55
switch(this.ordinal()) {
66
case 0:
7-
return "¦V¥ªÂà";
7+
return "向左轉";
88
case 1:
9-
return "¦V¥kÂà";
9+
return "向右轉";
1010
case 2:
11-
return "®gÀ»";
11+
return "射擊";
1212
default:
1313
return null;
1414
}

example/CH11/DetailAction2.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
public enum DetailAction2 {
2-
TURN_LEFT("向左轉"), TURN_RIGHT("向右轉"), SHOOT("射擊");
2+
TURN_LEFT("向左轉"), TURN_RIGHT("向右轉"), SHOOT("射擊");
33

44
private String description;
55

6-
// 不公開的建構方法
6+
// 不公開的建構方法
77
private DetailAction2(String description) {
88
this.description = description;
99
}

example/CH11/DetailAction3.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
public enum DetailAction3 implements IDescription {
2-
TURN_LEFT("向左轉"), TURN_RIGHT("向右轉"), SHOOT("射擊");
2+
TURN_LEFT("向左轉"), TURN_RIGHT("向右轉"), SHOOT("射擊");
33

44
private String description;
55

6-
// 不公開的建構方法
6+
// 不公開的建構方法
77
private DetailAction3(String description) {
88
this.description = description;
99
}

example/CH11/DetailActionDemo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
public class DetailActionDemo {
22
public static void main(String[] args) {
33
for(DetailAction action : DetailAction.values()) {
4-
System.out.printf("%s¡G%s%n",
4+
System.out.printf("%s%s%n",
55
action, action.getDescription());
66
}
77
}

example/CH11/EnumCompareTo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ public static void main(String[] args) {
44
}
55

66
public static void compareToAction(Action inputAction) {
7-
System.out.println("¿é¤J¡G" + inputAction);
7+
System.out.println("輸入:" + inputAction);
88
for(Action action: Action.values()) {
99
System.out.println(action.compareTo(inputAction));
1010
}

example/CH11/EnumDemo.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ public static void main(String[] args) {
66
public static void doAction(Action action) {
77
switch(action) {
88
case TURN_LEFT:
9-
System.out.println("¦V¥ªÂà");
9+
System.out.println("向左轉");
1010
break;
1111
case TURN_RIGHT:
12-
System.out.println("¦V¥kÂà");
12+
System.out.println("向右轉");
1313
break;
1414
case SHOOT:
15-
System.out.println("®gÀ»");
15+
System.out.println("射擊");
1616
break;
1717
}
1818
}

example/CH11/EnumDemo2.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ public static void main(String[] args) {
88
public static void doAction(InnerAction action) {
99
switch(action) {
1010
case TURN_LEFT:
11-
System.out.println("¦V¥ªÂà");
11+
System.out.println("向左轉");
1212
break;
1313
case TURN_RIGHT:
14-
System.out.println("¦V¥kÂà");
14+
System.out.println("向右轉");
1515
break;
1616
case SHOOT:
17-
System.out.println("®gÀ»");
17+
System.out.println("射擊");
1818
break;
1919
}
2020
}

example/CH11/MoreAction.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
public enum MoreAction implements IDescription {
22
TURN_LEFT {
3-
// 實作介面上的方法
3+
// 實作介面上的方法
44
public String getDescription() {
5-
return "向左轉";
5+
return "向左轉";
66
}
7-
}, // 記得這邊的列舉值分隔使用 ,
7+
}, // 記得這邊的列舉值分隔使用 ,
88

99
TURN_RIGHT {
10-
// 實作介面上的方法
10+
// 實作介面上的方法
1111
public String getDescription() {
12-
return "向右轉";
12+
return "向右轉";
1313
}
14-
}, // 記得這邊的列舉值分隔使用 ,
14+
}, // 記得這邊的列舉值分隔使用 ,
1515

1616
SHOOT {
17-
// 實作介面上的方法
17+
// 實作介面上的方法
1818
public String getDescription() {
19-
return "射擊";
19+
return "射擊";
2020
}
21-
}; // 記得這邊的列舉值結束使用 ;
21+
}; // 記得這邊的列舉值結束使用 ;
2222
}

example/CH11/MoreAction2.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
public enum MoreAction2 {
22
TURN_LEFT {
3-
// 實作抽象方法
3+
// 實作抽象方法
44
public String getDescription() {
5-
return "向左轉";
5+
return "向左轉";
66
}
7-
}, // 記得這邊的列舉值分隔使用 ,
7+
}, // 記得這邊的列舉值分隔使用 ,
88

99
TURN_RIGHT {
10-
// 實作抽象方法
10+
// 實作抽象方法
1111
public String getDescription() {
12-
return "向右轉";
12+
return "向右轉";
1313
}
14-
}, // 記得這邊的列舉值分隔使用 ,
14+
}, // 記得這邊的列舉值分隔使用 ,
1515

1616
SHOOT {
17-
// 實作抽象方法
17+
// 實作抽象方法
1818
public String getDescription() {
19-
return "射擊";
19+
return "射擊";
2020
}
21-
}; // 記得這邊的列舉值結束使用 ;
21+
}; // 記得這邊的列舉值結束使用 ;
2222

23-
// 宣告個抽象方法
23+
// 宣告個抽象方法
2424
public abstract String getDescription();
2525
}

example/CH11/MoreActionDemo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
public class MoreActionDemo {
22
public static void main(String[] args) {
33
for(MoreAction action : MoreAction.values()) {
4-
System.out.printf("%s¡G%s%n",
4+
System.out.printf("%s%s%n",
55
action, action.getDescription());
66
}
77
}

example/CH13/ArrayListDemo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public static void main(String[] args) {
88

99
List<String> list = new ArrayList<String>();
1010

11-
System.out.println("輸入名稱(使用quit結束)");
11+
System.out.println("輸入名稱(使用quit結束)");
1212

1313
while(true) {
1414
System.out.print("# ");
@@ -19,7 +19,7 @@ public static void main(String[] args) {
1919
list.add(input);
2020
}
2121

22-
System.out.print("顯示輸入: ");
22+
System.out.print("顯示輸入: ");
2323
for(int i = 0; i < list.size(); i++)
2424
System.out.print(list.get(i) + " ");
2525
System.out.println();

example/CH13/EnhancedForDemo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public static void main(String[] args) {
88

99
List<String> list = new ArrayList<String>();
1010

11-
System.out.println("輸入名稱(輸入quit結束)");
11+
System.out.println("輸入名稱(輸入quit結束)");
1212
while(true) {
1313
System.out.print("# ");
1414
String input = scanner.next();
@@ -18,7 +18,7 @@ public static void main(String[] args) {
1818
list.add(input);
1919
}
2020

21-
// 使用foreach來遍訪List中的元素
21+
// 使用foreach來遍訪List中的元素
2222
for(String s : list) {
2323
System.out.print(s + " ");
2424
}

example/CH13/EnumMapDemo.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ public static void main(String[] args) {
99
Map<Action, String> map =
1010
new EnumMap<Action, String>(Action.class);
1111

12-
map.put(Action.TURN_LEFT, "¦V¥ªÂà");
13-
map.put(Action.TURN_RIGHT, "¦V¥kÂà");
14-
map.put(Action.SHOOT, "®gÀ»");
12+
map.put(Action.TURN_LEFT, "向左轉");
13+
map.put(Action.TURN_RIGHT, "向右轉");
14+
map.put(Action.SHOOT, "射擊");
1515

1616
for(Action action : Action.values( ) ) {
1717
System.out.println(map.get(action));

example/CH13/EnumMapDemo2.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ public static void main(String[] args) {
99
Map<Action, String> map =
1010
new EnumMap<Action, String>(Action.class);
1111

12-
map.put(Action.SHOOT, "®gÀ»");
13-
map.put(Action.TURN_RIGHT, "¦V¥kÂà");
14-
map.put(Action.TURN_LEFT, "¦V¥ªÂà");
12+
map.put(Action.SHOOT, "射擊");
13+
map.put(Action.TURN_RIGHT, "向右轉");
14+
map.put(Action.TURN_LEFT, "向左轉");
1515

1616
for(String value : map.values( )) {
1717
System.out.println(value);

example/CH13/EnumSetDemo.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
import java.util.*;
44

5-
// ©w¸q¦CÁ|«¬ºA
5+
// 定義列舉型態
66
enum FontConstant { Plain, Bold, Italic }
77

88
public class EnumSetDemo {
99
public static void main(String[] args) {
10-
// «Ø¥ß¦CÁ|­È¶°¦X
10+
// 建立列舉值集合
1111
EnumSet<FontConstant> enumSet =
1212
EnumSet.of(FontConstant.Plain,
1313
FontConstant.Bold);
14-
// Åã¥Ü¶°¦X¤º®e
14+
// 顯示集合內容
1515
showEnumSet(enumSet);
16-
// Åã¥Ü¸É¶°¦X¤º®e
16+
// 顯示補集合內容
1717
showEnumSet(EnumSet.complementOf(enumSet));
1818
}
1919

0 commit comments

Comments
 (0)