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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
@SpringBootApplication() | |
public class PublisherIntegrationPlatformApplication extends SpringBootServletInitializer { | |
private static final Logger log = LoggerFactory.getLogger(PublisherIntegrationPlatformApplication.class); | |
public static void main(String[] args) { | |
SpringApplication.run(PublisherIntegrationPlatformApplication.class, args); | |
} | |
@Override |
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
/* a4.(橫條圖,bar graph) | |
* (1) - 亂數產生10個整數,值介於0-50之間,存到一維陣列內, | |
* public ArrayList<Integer> createNumber(){ | |
* | |
* } | |
* | |
* public void printStar(int num){ | |
* // 20 | |
* } | |
* |
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
/* | |
* a3.(頻度統計,histogram) 亂數產生1000個介於1~10的整數, | |
* 請統計1~10各出現多少次. | |
* | |
* (1) 用 HashMap 的方式! | |
* (2) 用 Array 的方式! | |
*/ |
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
/* | |
u1-1. (*) 寫三個方法取出年、月、日 , 2017/01/21 | |
public int getYear(String date){ | |
// 2017 | |
} | |
public int getMonth(String date){ | |
//1 |
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
/* | |
s1.(成績簿) | |
實作一成績簿類別GradeBook,內含私有科目名courseName,型別為字串, | |
對外提供如下公開方法: | |
public String getCourseName() // 讀出科目名 | |
public void setCourseName(String name) // 寫入科目名 | |
public void displayMessage() // 印"歡迎來到xx成績簿物件"訊息,xx為科目名 | |
測試時,可建構一個成績簿物件,向用戶要一個科目名, | |
寫入成績簿物件,再讀出,並列印訊息. | |
*/ |
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
/* | |
s4.(戶頭) | |
實作一戶頭類別Account,內含私有餘額balance,型別實數, | |
對外提供如下公開方法: | |
public Account(double initialBalance) //建構子,含初始餘額 | |
public void credit(double amount) // 存款,含存款金額 | |
public double getBalance() // 讀出餘額,回傳餘額 | |
測試時,可用建構子建立一個戶頭,初始餘額為50,先印餘額看對不對, | |
再存入25,印餘額看對不對. |
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
public class FolderRead { | |
public static void main(String[] args) throws IOException { | |
// files 路徑 | |
File files1 = new File("files"); | |
File[] files2 = files1.listFiles(); | |
for (File file : files2) { |
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 Exception1 extends Exception{} | |
class Exception2 extends Exception1{} | |
class Exception3 extends Exception2{} | |
class Lazy{ | |
public void foot(int i) throws Exception1 { | |
if(i == 1){ | |
throw new Exception1(); | |
} else if(i==2){ | |
throw new Exception2(); | |
} else if(i==3){ |
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
try{ | |
Lazy sample = new Lazy(); | |
l.foo(1); | |
} catch (Exception1 exec){ | |
// Handle | |
// 在這裡你很難發現 Exception 是 Exception1 or Exception 2 or Exception3 | |
} |