This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class 類別基本理論 | |
| class 是個很抽象的東西,可以把它當成是"設計圖"。 | |
| 用人來比喻,一點一點的建構出來: | |
| 先不考慮公有(public)與私有(private) | |
| 我們定義一個人 | |
| **(類別) | |
| public class People{ | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Abstract Class(抽像類別),Interface(介面or接口) | |
| Abstract Class(抽像類別): | |
| ---------------------------------------------------------------------------------------- | |
| [1]...顧名思義因為是抽象,所以無法產生(new)物件 | |
| abstract class AbClass{ | |
| -- aaa() 是有明確定義的方法 | |
| void aaa(){ | |
| // method here | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.BufferedReader; | |
| import java.io.FileReader; | |
| import java.io.IOException; | |
| // 回文 | |
| public class Q940301 { | |
| public static void main(String[] args) throws IOException { | |
| String fileName = "940301.SM"; | |
| FileReader fr = new FileReader(fileName); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.File; | |
| import java.io.IOException; | |
| import java.util.Scanner; | |
| // 數列直角三角形 | |
| public class Q940302 { | |
| public static void main(String[] args) throws IOException { | |
| String fileName = "940302.SM"; | |
| File f = new File(fileName); | |
| Scanner sc = new Scanner(f); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.File; | |
| import java.io.FileNotFoundException; | |
| import java.util.Scanner; | |
| // 找質數 | |
| public class Q940303 { | |
| public static void main(String[] args) throws FileNotFoundException { | |
| String fileName = "940303.SM"; | |
| File f = new File(fileName); | |
| Scanner sc = new Scanner(f); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.BufferedReader; | |
| import java.io.FileReader; | |
| import java.io.IOException; | |
| // 判斷BMI | |
| public class Q940304 { | |
| public static void main(String[] args) throws IOException { | |
| String fileName = "940304.SM"; | |
| FileReader fr = new FileReader(fileName); | |
| BufferedReader br = new BufferedReader(fr); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package Quiz; | |
| import java.io.BufferedReader; | |
| import java.io.FileReader; | |
| import java.io.IOException; | |
| // 2矩陣相加 (等邊的方矩陣) | |
| public class Q940305 { | |
| public static void main(String[] args) throws IOException{ | |
| String fileName = "940305.SM"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.BufferedReader; | |
| import java.io.FileReader; | |
| import java.io.IOException; | |
| // 身份證驗證 | |
| public class Q940306 { | |
| public static String sample = "ABCDEFGHJKLMNPQRSTUVXYWZIO"; | |
| public static void main(String[] args) throws IOException{ | |
| String fileName = "940306.SM"; | |
| FileReader fr = new FileReader(fileName); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.BufferedReader; | |
| import java.io.FileReader; | |
| import java.io.IOException; | |
| // 車流量 | |
| public class Q940307 { | |
| public static void main(String[] args) throws IOException { | |
| String fileName = "940307.SM"; | |
| FileReader fr = new FileReader(fileName); | |
| BufferedReader br = new BufferedReader(fr); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.BufferedReader; | |
| import java.io.FileReader; | |
| import java.io.IOException; | |
| // 2個分數加減乘除 | |
| public class Q940308 { | |
| public static void main(String[] args) throws IOException{ | |
| String fileName = "940308.SM"; | |
| FileReader fr = new FileReader(fileName); | |
| BufferedReader br = new BufferedReader(fr); |