Skip to content

Commit 50dbafc

Browse files
committed
Merge pull request JustinSDK#1 from DonaldIsFreak/FixExample
[Fix] Example的程式碼出現亂碼 --------------------------------------------- 原本都是在 Windows 下設計範例,因而原始碼是採預設的 MS950 編碼,現在將所有範例改為 UTF-8,直接使用 javac 編譯時請加上 -encoding UTF-8。
2 parents 7df493e + 15afd31 commit 50dbafc

File tree

205 files changed

+907
-907
lines changed

Some content is hidden

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

205 files changed

+907
-907
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
}

0 commit comments

Comments
 (0)