This is a first course in Computer Science using the programming language Java. It is intended for high school AP Computer Science classes, for university level CS-I classes, and for self study.
For maximum benefit, go though these notes interactively, thinking about and answering the question at the bottom of each page. There are about 20 pages per chapter. If you spend about 3 minutes per page each chapter will take about 60 minutes, or longer if you copy and run some of the programs. If you are a beginning programmer, plan on spending more than a month with this.
These notes assume that you have the Java version 7.0 or later from Oracle, Inc. at http://https://www.oracle.com/java/technologies/java-se-glance.html and a text editor such as Notepad or Notepad++. They may be used with an integrated development environment such as BlueJ, as well. For more about these notes check the frequently asked questions.
Super Easy Way to Run Java: The web site https://www.codiva.io/ lets you copy-and-paste Java code into a web page text box, then compile and run it completely within your browser. This is ideal for playing with the short example programs in many of these chapters. Another site that does this is https://ideone.com/
A German translation of these notes, done by Heinrich Gailer, is available at www.gailer-net.de/tutorials/java/java-toc.html.
Part 1: Hardware and Software | |||||
Chapter 1 | Computer Systems | Quiz | Flash Cards | Review | |
Chapter 2 | Analog and Binary Signals | Quiz | Flash Cards | Review | |
Chapter 3 | Computer Memory | Quiz | Flash Cards | Review | |
Chapter 4 | The Processor | Quiz | Flash Cards | Review | |
Part 2: Running Java Programs | |||||
Chapter 5 | Introduction to Java | Review | |||
Chapter 6 | Small Java Programs | Review | |||
Chapter 7 | How to Run the Example Programs | Review | |||
Part 3: Data | |||||
Chapter 8 | Primitive Data | Quiz | Exercises | Flash Cards | |
Chapter 9 | Variables and the Assignment Statement | Quiz | Exercises | Flash Cards | |
Chapter 10 | Expressions and Arithmetic Operators | Quiz | Exercises | Flash Cards | |
Chapter 11 | Object Data | Quiz | Exercises | ||
Chapter 12 | Input and Output | Review | Exercises | ||
Chapter 13 | Floating Point and Math | Review | Exercises | ||
Chapter 14 | Formatted Output with DecimalFormat | Quiz | Exercises | ||
Chapter 15 | Formatted Output with printf() | Quiz | Exercises | ||
Part 4: Branches and Loops | |||||
Chapter 16 | The if Statement |
Quiz | Exercises | ||
Chapter 17 | The Single Branch if Statement |
Quiz | Exercises | ||
Chapter 18 | Boolean Expressions | Review | Exercises | Flash Cards | |
Chapter 19 | Loops and the while statement |
Review | Exercises | ||
Chapter 20 | Counting Loops | Quiz | Exercises | ||
Chapter 21 | Nesting Loops and Ifs | Review | Exercises | ||
Chapter 22 | Sentinel-controlled Loops | Review | Exercises | ||
Chapter 23 | Result-controlled Loops | Quiz | Exercises | ||
Chapter 24 | The for Statement |
Quiz | Exercises | ||
Chapter 25 | More about the for Statement |
Quiz | Exercises | ||
Part 5: More Java Features |
|||||
Chapter 30 | Random Numbers | Quiz | Exercises | Review | |
Chapter 31 | Increment, Decrement, and Assignment Operators | Quiz | Exercises | ||
Chapter 32 | Boolean Expressions and Short-circuit Operators | Quiz | Exercises | Review | |
Chapter 33 | Truth Tables and De Morgan's Laws | Review | |||
Chapter 34 | The Conditional Operator and the switch Statement |
Quiz | Exercises | ||
Chapter 35 | The do Statement |
Quiz | Exercises | ||
Part 6: Object Oriented Programming |
|||||
Chapter 40 | Objects | Quiz | |||
Chapter 41 | Object References | Quiz | |||
Chapter 42 | More about Objects and Classes | Review | |||
Chapter 43 | Method Parameters | Review | |||
Chapter 44 | Strings and Object References | Quiz | Exercises | ||
Chapter 45 | More about Strings | Quiz | Exercises | ||
Chapter 46 | Defining your own Classes | Review | Exercises | ||
Chapter 47 | Class Design Example: Cone | Review | Exercises | ||
Chapter 49 | Class Design Example: Checking Account | Review | |||
Chapter 50 | Encapsulation and Visibility Modifiers | Quiz | Exercises | ||
Chapter 51 | Parameters, Overloading, Local Variables | Review | |||
Chapter 52 | Object Parameters | Quiz | |||
Chapter 53 | Objects that Contain Objects | Review | Exercises | ||
Chapter 54 | Static Methods | Quiz | Exercises | ||
Part 7: Arrays |
|||||
Chapter 60 | Arrays | Quiz | Exercises | ||
Chapter 61 | Useful Array Algorithms | Quiz | Exercises | ||
Chapter 62 | Objects that Contain Arrays | ||||
Chapter 63 | Arrays as Parameters | Review | Exercises | ||
Chapter 64 | Methods that Change Arrays | Quiz | |||
Chapter 65 | Arrays of Objects | Quiz | |||
Chapter 66 | Linear Search | Exercises | |||
Chapter 67 | Two Dimensional Arrays | Exercises | |||
Chapter 68 | StringBuffers | Quiz | Exercises | ||
Part 8: File Input and Output | |||||
This section may be started after Part 4 | |||||
Chapter 70 | Files and File Redirection | Review | Exercises | ||
Chapter 71 | Reading Data with File Redirection | Review | Exercises | ||
Chapter 72 | I/O using Scanner and PrintWriter | Review | Exercises | ||
Chapter 73 | File Input Techniques | Review | Exercises | ||
Part 9: Advanced Object Oriented Programming |
|||||
Chapter 80 | Inheritance | Quiz | |||
Chapter 81 | Abstract Classes and Polymorphism | Quiz | |||
Chapter 82 | More about Polymorphism | Quiz | |||
Chapter 83 | Interfaces | Quiz | |||
Chapter 84 | The Comparable Interface | Quiz | Exercises | ||
Chapter 85 | ArrayLists and Iterators | Quiz | |||
Chapter 86 | BigInteger | Quiz | Exercises | ||
Part 10: Recursion |
|||||
Chapter 90 | Recursion | Quiz | Exercises | ||
Chapter 91 | Recursion in Java | Quiz | Exercises | Adventure | |
Chapter 92 | Examples of Recursion | Quiz | Exercises | ||
Chapter 93 | More Recursion | Quiz | Exercises | ||
Chapter 94 | Recursion with Strings | Exercises | |||
Chapter 95 | Recursion with Graphics | Exercises | |||
Chapter 96 | Classic Fractals | ||||
Part 11: Exceptions |
|||||
Chapter 100 | Exceptions | Quiz | Exercises | ||
Chapter 101 | More about Exceptions | Quiz | Exercises | ||
Chapter 102 | Scanner, PrintWriter, and Exceptions | ||||
Chapter 103 | Input and Output Streams | Quiz | |||
Chapter 104 | Writing Binary Files | Quiz | Exercises | ||
Chapter 105 | Reading Binary Files | Quiz | Exercises | ||
Chapter 106 | The File Class | Quiz | Exercises | ||
Part 12: Sorting |
|||||
Chapter 110 | Selection Sort | Exercises | |||
Chapter 111 | Insertion Sort | Exercises | |||
Chapter 112 | Sorting with Objects | ||||
Part 13: Graphics |
|||||
This section may be started after Part 9 | |||||
Chapter 120 | Beginning JavaFX | Quiz | Exercises | ||
Chapter 121 | More JavaFX Shapes | Quiz | Exercises | ||
Part 14: Linked Lists |
|||||
Chapter 130 | Beginning Linked Lists | Exercises | |||
Chapter 131 | Unordered Linked List | Exercises | |||
Chapter 132 | Ordered Linked List | Exercises | |||
Chapter 133 | Generic Linked List | ||||
Index |
|||||
Index |
Introduction to Computer Science using Java is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.