Java Programming

Location: Room 223B, 德田館
Time: 0900 ~ 1200, Saturday and Sunday


``Java is C++ without the guns, knives, and clubs.''
-- James Gosling, co-inventor of Java (1955-)

Instructor Information

Wi-Fi Access

Recording Classroom Lectures Policy Recording of classroom lectures is prohibited unless advance written permission is obtained from the class instructor and any guest presenter(s).

Objectives

This course is designed for the students who want to learn Java but have no programming experience before. We will start with the very beginning of program design and fundamental concepts about programs and machines. You are expected to be capable to implement your idea in Java independently after 30 hours of lectures. Furthermore, I wish you could learn other programming languages without suffering from starting over.

The topics delivered in the following weeks are as follows:

In my humble wish, I am trying to show you more than Java itself, but a big picture of computer science.

Prerequisites

Text

Overview

Algorithm-oriented programming

Object-oriented programming

Applications

Design patterns

TODO list

Schedule [ 247, 250, 251, 252, 253, 254, 255, 260, 261, 263, 265, 266, 268, 269, 271, 274, 275, 276, 277, 278, 280, 281, 281n, 282, 283, 284, 286, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 301, 304, 305, 306, 307, 308, 310, 311, 312, 313, 314, 315, 316, 318, 319, 320, 321 ]

Date Summary
2019.11.9
  • Background knowledge: computer system (cpu-memory model), programming languages, algorithms, Alan Turing
  • Installation: JDK8 + Eclipse
  • First Java program
2019.11.10
  • Data types, variables, and operators
    • Variable declaration (with memory address)
    • Primitive types: int, double, char, boolean, and more
    • Operators: assignment operator (=), arithmetic operators (+, −, *, /, %), rational operators (>, <, ==), logical operators (!, &&, ||, ∧), compound arithmetic operators (+=, ++)
    • Type conversion (casting)
    • Reference types: String and Scanner
    • Memory model: stack & heap
  • Homework 0 (no due date)
2019.11.16
  • Flow controls
    • Selections (branching): if-else if-else, switch-case-default, ?: operator
    • Digression: pseudo random number generator (PRNG)
    • Repetitions: while loop
2019.11.17
  • Flow controls (cont'd)
    • Repetitions: do-while loop, for loop
    • Numerical examples
  • Homework 1
2019.11.23
  • Flow controls (cont'd)
2019.11.24
  • Data structures
    • Arrays: syntax and memory allocation
    • Common algorithms
      • Data generation by PRNG
      • Descriptive statistics: max/min, location of max/min, sum, mean, variance, standard deviation
      • Shuffling algorithm
    • Cloning arrays
    • For-each loops
    • Additional programming exercises are selected from LeetCode: https://hackmd.io/@arthurzllu/SyhV3mY3B (If you are interested in taking on challenges of LeetCode, welcome to contact me.)
  • Homework 2
2019.11.30
  • Data structures (cont'd)
    • Sorting algorithms: bubble sort, selection sort, insertion sort
    • Searching algorithms: linear search, binary search
    • More data structures: a glimpse on linked list
    • Higher-dimensional arrays feat. memory model
    • Upgraded array: ArrayList with a short introduction to generics
  • Methods and recursion
    • Method definition & implementation
2019.12.1
  • Methods and recursion (cont'd)
    • Call stack & variable scope (again, with memory model)
    • Method overloading and varargs method
    • Recursive algorithms: factorial, greatest common divisor, fibonacci numbers
      • (FYR) recursion from University of Illinois at Urbana-Champaign
  • Object-oriented programming
  • Homework 3
2019.12.7
  • Object-oriented programming (cont'd)
    • Encapsulation: private fields and public methods
    • Constructors
    • The this operator
    • Instance/static members
    • Garbage collection
    • UML: class diagram
    • HAS-A relationship (aggregation)
    • First IS-A relationships: class inheritance
    • Constructor chaining and the super operator
    • Method overriding
2019.12.8
  • Object-oriented programming (cont'd)
    • Subtype polymorphism: up/down casting
    • The instanceof operator
    • Abstract class/method
    • Final variable/method/class
    • Second IS-A relationships: interface inheritance
    • Wrapper classes
    • Immutability by example: String (try another text object which is mutable: StringBuffer)
    • Enumeration
    • Packages & access controls (public/protected/private)
    • Imports
    • Inner class (composition) by example: stack by linked list
    • Anonymous class by example: Iterable/Iterator associated with for-each loop
    • Static class
  • Application: exception handling
  • Application: Java GUI
  • Application: Java New I/O
  • Application: date and time
  • Homework 4
    • Lab 5
    • All homework submissions are due 12.15
Promotion Java Programming 2 (sign-up);

Sample code

Gradebook

Programming Labs

Grading Policy Since Java 310, I've canceled the final exam for your final grade. As the minimal requirement to acquire the certificate of course completion, you need to finish all labs w/o (optional). I suggest that you could try optional labs as many as possible. For the record, this course is offered without any course credit of National Taiwan University, in compliance with Implementation Regulations Governing Colleges Continuing Education, Ministry of Education.

Late Homework Policy All programming labs should be submitted before the last date of class in order to deliver your final grades to the office so that the certificates can be issued soon. (See a recent complaint letter here.)

Homework Submission Send the source code (the file with .java extension) to my email shown in the beginning of this page. Remember to indicate this class number, your full Chinese name, and homework number in your email title. For example, [Java 321] Homework 1 盧政良. Do not attach any class file because any executable file will be ruled out by Gmail.

References

Java (introductory level)

Java (advanced level)

Data structures and algorithms

Object-oriented analysis and design

Computer organization/architecture

AP Computer Science related

Misc

Additional reading