Archive: 2020/5

0

Java 快速學習自我挑戰 Day7

控制流陳述句 從 String 解析出值 使用 Integer.parseInt 就可以將 String 轉換為 int。 1234567891011121314151617181920public static void main(String[] args) { String numberAsSting = "2018"; System.out

0

Java 快速學習自我挑戰 Day6

控制流陳述句 數字和挑戰 Write a method with the name sumDigits that has one int parameter called number. If parameter is >= 10 then the method should process the number and return sum of all digits, otherw

0

Java 快速學習自我挑戰 Day5

控制流陳述句(Control Flow Statements) Switch 陳述句 Switch 陳述句就是 if-else 的取代版本,如果條件很多的情況下,用 switch 會更簡潔,也可以同時定義很多 case 並執行一種命令。最重要的是,每個 case 最後面一定要加上 break,否則會繼續執行,最後一個可以不加,但是為了程式碼的完整性,會建議加上。 1234567891011

0

Java 快速學習自我挑戰 Day4

題目練習 題目五 Write a method areEqualByThreeDecimalPlaces with two parameters of type double. The method should return boolean and it needs to return true if two double numbers are the same up to three d

0

Java 快速學習自我挑戰 Day3

Java 教學 - 表達式(Expressions)、陳述句(Statements)、程式碼區塊(Code Blocks)、方法(Methods)…等等 關鍵字(Keywords)和表達式(Expressions) Java Keyword 列表 int int = 5;,這樣的語法會出現錯誤,關鍵字是被保留的,所以在命名變數的時候,不能使用跟關鍵字同名的變數。 裡面的 kilometers

0

Java 快速學習自我挑戰 Day2

第一步 - PartII Java 型態轉換(Java Casting) Casting 就是將數字從一個型態轉為另一個型態,我們將我們想要的型態放到 () 裡面,像這樣:(byte) (myMinByteValue / 2) 其它語言也有型態轉換,這不是 Java 獨有的功能。 如果不指定型態,Java 會默認為 Integer。 原始型態挑戰 挑戰:創建一個 byte 變數並設為有效

0

Java 快速學習自我挑戰 Day1

課前準備 問問題的技巧 盡可能地精準的問問題:貼上程式碼,加一些畫面截圖。 問別人沒問過的問題:在問問題之前,先找找看別人有沒有問過。 成為工程師的四個階段 Unconscious Incompetence (無意識的無能):在剛開始起步的時候,你不知道你不會什麼,所以不要做長期規劃,應該要專注在基礎上面。 Conscious Incompetence (有意識的無能):你做一些調查