Java Programming

Location: Room 223A, 德田館
Time: 1900 ~ 2200, Tuesday & Friday


``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, 322, 323, 325 ]

Date Summary
2020.2.4 video
  • Background knowledge: computer system (cpu-memory model), programming languages, algorithms, Alan Turing
  • Installation: JDK8 + Eclipse
  • First Java program
2020.2.7
  • 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)
2020.2.11
  • Flow controls
    • Selections (branching): if-else if-else, switch-case-default, ?: operator
    • Digression: pseudo random number generator (PRNG)
    • Repetitions: while loop, do-while loop, for loop
2020.2.14
  • Flow controls (cont'd)
    • Numerical examples
    • Jump statements
  • Homework 1
2020.2.18
  • Flow controls (cont'd)
  • Data structures
    • Arrays: syntax & memory allocation
    • Common algorithms
    • Data generation by PRNG
    • Descriptive statistics: max/min, location of max/min, sum, mean
2020.2.21
  • Data structures (cont'd)
    • Random permutation (shuffling)
    • Cloning arrays (shallow copy?)
    • For-each loops
    • More data structures: a glimpse on linked list
    • Sorting algorithms: bubble sort, selection sort, insertion sort
    • Searching algorithms: linear search, binary search
    • Higher-dimensional arrays feat. memory model
    • Upgraded array: ArrayList with a short introduction to generics
    • 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
2020.2.25
  • Methods and recursion
    • Method definition & implementation
    • 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
2020.2.28 no class
2020.3.3
  • Object-oriented programming
    • Class & object
    • Encapsulation: private fields and public methods
    • Constructors
    • The this operator
    • Instance/static members
    • Garbage collection
    • UML: class diagram
    • HAS-A relationship (aggregation)
  • Homework 3
2020.3.6
  • Object-oriented programming (cont'd)
    • First IS-A relationships: class inheritance
    • Constructor chaining and the super operator
    • Method overriding
    • Subtype polymorphism: up/down casting
    • The instanceof operator
    • Abstract class/method
    • Final variable/method/class
    • Second IS-A relationships: interface inheritance
  • Homework 4
2020.3.10
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 325] 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 (Taiwan)

AP Computer Science (American School)

Misc

Additional reading