Java Programming
Time: 0900 ~ 1200, Saturday and Sunday
Location: Room 223A, 德田館
``Java is C++ without the guns, knives, and clubs.''
-- James Gosling, co-inventor of Java (1955-)
Course Description
To the students,
This course is designed for the students who want to learn Java programming without any experiences before. We will start with the very beginning of program design and the fundamental concepts of how the programs execute the instructions. You are expected to be capable to implement your idea with Java independently after 30 hours of lectures. Furthermore, I wish you could learn other programming languages without suffering from starting over.
Enjoy your coding time.
- Textbook
- References
- Java
- Learning Java, Patrick Niemeyer and Daniel Leuck, 4/e, 2013
- Beginning Java 8 Fundamentals, Kishori Sharan, 2014
- Java in a Nutshell, Benjamin J Evans and David Flanagan, 6/e, 2014
- Introduction to Java Programming: Comprehensive Version, Y. Daniel Liang, 10/e, 2014
- Java: The Complete Reference, Herbert Schild, 9/e, 2014
- Effective Java, Joshua Bloch, 2/e, 2008
- Java Performance: The Definitive Guide, Scott Oaks, 2014
- Data structures and algorithms
- Object-oriented design
- Network programming
- Eclipse
- Additional readings
- Why Learn to Program?, Alex Allain
- 為什麼要學各種程式語言, NiwaSho Lin, 2012.11.21
- 資深開發者給後輩的七個 Coding 學習心得, TechOrange, 2013.11.29
- 大企業都在用哪些程式語言?圖解程式語言編年史, T客邦, 2013.12.16
- The reason everyone should learn to code, Mike Loukides, 2014.1.22
- 如何成為一個偉大的開發者?, TechOrange, 2014.6.20
- 前蘋果高層史丹佛畢典演講:想換工作,別在辦公室等著別人幫你下決定, TechOrange, 2014.7.7
- 沒神奇公式和捷徑,這11步驟就是成為頂尖Coder的必備條件, TechOrange, 2014.7.9
- 高生產力工程師的兩個特徵:聰明、懶惰, INSIDE, 2014.7.14
- 笑傲「演算法」江湖的獨孤九劍, INSIDE, 2014.8.14
- Google工程師親授:菜鳥開發者一定要投資的十大標的, TechOrange, 2014.9.17
- 在美國,寫什麼程式收入最高?答案是:Java, T客邦, 2014.10.9
- 我們之前說錯了嗎?Coding 竟不是新世代必備能力, TechOrange, 2015.2.6
- code 海無涯,不想溺斃就快抓緊這 6 個緊急救生圈吧!, TechOrange, 2015.5.26
- 程式初學者的失落之鑰 - “Computational Thinking”, 程式教育的唐吉訶德, 2015.6.2 (Original: Computational thinking and thinking about computing, Jeannette M Wing, 2008.10.28)
- 24 小時學會 Java 程式?想成為武林高手,還是先花 10 年磨一劍吧!, TechOrange, 2015.8.19
- Related courses
The major topics covered in the short course, time permitting, are listed below for your reference.
- Overview: preliminary knowledge of computer science, installation of Eclipse
- Data types and identifiers
- Operators
- Control structures: selections, iterations
- Classes and objects
- Methods and recursions
- Program design and analysis of algorithms: UML, O-notation
- Object composition: ``has-a'' relationship
- Inheritance and polymorphism: ``is-a'' relationship, upcasting, downcasting
- Interfaces
- Generics
- Exception handling
- File input and output
- Multi-threaded programming
- GUI by Swing
- Fundamentals of network programming
- Applets, servlets, and JSP
- 2015.9.5
- 2015.9.6
- 2015.9.12 no class (Power cut for regular check)
- 2015.9.13 (4 hours)
- 2015.9.19 (4 hours)
- 2015.9.20 (4 hours)
- Problem 1: Greatest common divisor. Let a and b be two input numbers. Assume a > b for simplicity. Write two programs which use the loop approach and the recursive approach to calculate the greatest common divisor of a and b, respectively.
- Problem 2: Estimating pi value by Monte Carlo. Let n be the number of simulation paths. The algorithm is as follows:
- Declare m = 0 and i = 0.
- Use Math.random() to generate x and y with i = i + 1.
- If x ^ 2 + y ^ 2 < 1, then m = m + 1.
- Repeat (2) until i > n.
- Print 4 * m / n.
- Problem 3: Number guessing game. Write a program which generates a secret number, randomly between 0 and 99, and receives the input from the player for his/her guess until the game is over. If the guess is equal to the secret number, then the player wins. Otherwise, for the guess higher/lower than the secret number, the program prints ``Too high.'' and ``Too low.'', respectively. If the player tries more than 10 times, then the player lose the game.
- Sample codes: YangTina.zip (Contributed by Ms. Tina Yang)
- 2015.9.26 no class
- 2015.9.27 no class
- 2015.10.3
- 2015.10.4
- Class-2 (Thanks to Mr. Sung)
- Problem 4: Observe in your daily life. Try to describe a thing and organize the thing into a class. The class TV is one example we created in class. Now make one class on your own. The class you define has at least two fields and two methods. Write a program which demonstrates your objects based on this class.
- Problem 5: Recall that we define a new class Point for 2D points in Cartesian coordinate. Now define the class Triangle which contains three Point objects and two methods: getPerimeter() which returns its perimeter, and getArea() which return its area. Note that the perimeter can be determined by summing the length of sides, and the area can be determined by Heron formula. Write a program which demonstrates your triangle object, say, a triangle whose side lengths are 3, 4, and 5, respectively. Feel free to add extra fields in the class, say, color. (sol)
- Problem 6: Play with CodeBat. You don't need to hand in the solution for this problem. Just do more exercises for your own good.
- Reading material: 不廢話!五組程式碼,道盡 Coder 10 年幽幽練功路, TechOrange, 2015.10.2
- 2015.10.10 no class
- 2015.10.11 no class
- 2015.10.17
- 2015.10.18, solution (Contributed by Ms. Tina Yang),
feedback sheet
Sample Codes
As a beginner, avoid copying. Please write the code on your own.
Grading Policy
- Programming Assignments (40 points)
- Final Exam (60 points)
You will get the certificate for this course if you acquire more than 70 points in total.