Introduction to Computer Science I
Purpose of Course showclose
Course Information showclose
Primary Resources: This course is comprised of a range of different free online materials. However, the course makes primary use of the following materials:
- Oracle’s The Java Tutorials
Note that you will only receive an official grade on your Final Exam. However, in order to adequately prepare for this exam, you will need to work through all of the resources in each unit.
In order to “pass” this course, you will need to earn a 70% or higher on the Final Exam. Your score on the exam will be tabulated as soon as you complete it. If you do not pass the exam, you may take it again.
Time Commitment: Completing this course should take you a total of 89.75 hours. Each unit includes a “time advisory” that lists the amount of time you are expected to spend on each subunit. These should help you plan your time accordingly. It may be useful to take a look at these time advisories and to determine how much time you have over the next few weeks to complete each unit, and then to set goals for yourself. For example, Unit 1 should take you 16.5 hours. Perhaps you can sit down with your calendar and decide to complete subunit 1.1 (a total of 3 hours) on Monday; sub-subunit 1.2.1 (a total of 2.5 hours) on Tuesday; sub-subunits 1.2.2 and 1.2.3 (a total of 4.25 hours) on Wednesday; etc.
Tips/Suggestions: As you read or view resources, take careful notes on a separate sheet of paper. These notes will be useful to use as a study guide when you prepare for the Final Exam.
Learning Outcomes showclose
- discuss the history of computing as well as fundamental hardware and software concepts;
- explain the programming life cycle;
- explain how the JVM translates Java code into executable code;
- explain Object-Oriented Programming concepts such as objects, classes, inheritance and polymorphism;
- write simple programs using basic Java concepts;
- discuss and use primitive data types in Java;
- discuss and use logical and relational operators and compare Boolean expressions;
- explain and use various control structures such as methods, decision statements, and loops;
- use exception handling mechanism; and
- use Java input/output class hierarchy to read and write data to and from external files.
Course Requirements showclose
√ have access to a computer;
√ have continuous broadband Internet access;
√ have the ability/permission to install plug-ins or software (e.g. Adobe Reader or Flash);
√ have the ability to download and save files and documents to a computer;
√ have the ability to open Microsoft files and documents (.doc, .ppt, .xls, etc.);
√ have competency in the English language; and
√ have read the Saylor Student Handbook.
Unit Outline show close
Expand All Resources Collapse All Resources
-
Unit 1: Introduction
We will begin this course by identifying our motivation for learning fundamental programming concepts and learning the history of programming languages in general. We will then discuss the hardware (the physical devices that make up the computer) and software (Operating Systems and applications that run on the computer) of a computer. We will conclude with a brief discussion of the Java programming language, which we will use throughout the rest of this course. By the end of this unit, you will have a strong understanding of the history of programming and be well prepared to learn about programming concepts in greater detail.
Unit 1 Time Advisory show close
Unit 1 Learning Outcomes show close
- 1.1 History and Motivation
-
1.1.1 History of Software and Computer System Design
- Reading: The Saylor Foundation’s “History of Software and Computer System Design”
Link: The Saylor Foundation’s “History of Software and Computer System Design” (PDF)
Instructions: Please read this article for a solid overview of the history of computers and software.
Reading this article should take approximately 1 hour.
Terms of Use: This resource is licensed under a Creative Commons Attribution 3.0 License. It is attributed to The Saylor Foundation.See a broken link? Please let us know!
- Reading: The Saylor Foundation’s “History of Software and Computer System Design”
-
1.1.2 Evolution of Programming
- Reading: The History of Computing Project: Cornelis Robat’s “Introduction to Software History”
Link: The History of Computing Project: Cornelis Robat’s “Introduction to Software History” (PDF)
Instructions: Please read this article which focuses on the evolution of programming languages over the years.
Reading this article should take approximately 2 hours.
Terms of Use: This resource is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. It is attributed to Cornelius Robat and the original version can be found here.See a broken link? Please let us know!
- Reading: The History of Computing Project: Cornelis Robat’s “Introduction to Software History”
- 1.2 Hardware/Software Model of a Computer
-
1.2.1 Hardware vs. Software
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 1: Introduction to Computer Systems”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 1: Introduction to Computer Systems” (PDF)
Instructions: Please review the notes for Chapter 1. For maximum benefit, go through these notes interactively, thinking about and answering the questions at the bottom of each page.
These notes are an experiment in applying the “programmed learning” method to web-based computer aided instruction. The subject is Java Programming for beginning programmers. The content is intended to start beginning programmers out on the track to professional-level programming and reinforce learning by providing abundant feedback.
Studying this chapter should take approximately 2 hours.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML or MP3). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Assessment: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz for Chapter 1”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz for Chapter 1” (PDF)
Instructions: Please complete the multiple-choice quiz.
Completing this assessment should take approximately 30 minutes.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 1: Introduction to Computer Systems”
-
1.2.2 Programs and Processes
- Web Media: Khan Academy’s “Binary Numbers”
Link: Khan Academy’s “Binary Numbers” (YouTube)
Instructions: Please watch this lecture on Binary Numbers, which are used to represent numbers in computer memory. In fact, all types of information, not just numbers, but characters as well, are stored in memory using binary bits (i.e. digits) of 0 and 1. We still write numbers in our programs using decimal numbers, but the interpreter converts them to binary when it interprets them for execution as part of a machine language instruction (the interpreter interprets the Java or Python statement to equivalent, i.e. same semantics, machine language statements). If you are familiar with and understand the concepts of base 10 radix (decimal number system) and base 2 radix (binary number system), you may skip this lecture.
Watching the lecture and taking notes should take approximately 15 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 4: The Processor”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 4: The Processor” (PDF)
Instructions: Please review the notes for Chapter 4. As you work through the notes, think about and answer the questions at the bottom of each page.
Reading this chapter should take approximately 2 hours.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML or MP3). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Assessment: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz for Chapter 4”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz for Chapter 4” (PDF)
Instructions: Please complete the multiple-choice quiz.
Completing this assessment should take approximately 30 minutes.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML or MP3). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Web Media: Khan Academy’s “Binary Numbers”
- 1.2.3 The Programming Lifecycle
-
1.2.3.1 Concept
- Reading: The Saylor Foundation’s “Programming Lifecycle: Concept”
Link: The Saylor Foundation’s “Programming Lifecycle: Concept” (PDF)
Instructions: Please read this brief article about the programming lifecycle. Note that this reading covers the topics outlined in sub-subunits 1.2.3.2 – 1.2.3.7.
Terms of Use: This resource is licensed under a Creative Commons Attribution 3.0 License. It is attributed to The Saylor Foundation.See a broken link? Please let us know!
- Reading: The Saylor Foundation’s “Programming Lifecycle: Concept”
-
1.2.3.2 Design
Note: Once you have listened the tutorial on the introduction to the waterfall model, please click ‘continue’ to hear the tutorial on the requirements and the design process. Please take notes as you listen to this audio tutorial.
-
1.2.3.3 Development/Implementation
Note: Continue listening to the audio tutorial to learn about software development and implementation process.
-
1.2.3.4 Testing
Note: After listening to the section on development/implementation process, listen to the section on testing by clicking the ‘continue’ button.
-
1.2.3.5 Deployment
Note: Once the software is tested, the next step is to deploy it. Please continue listening to the tutorial for the section on deployment by clicking the ‘continue’ button.
-
1.2.3.6 Support
Note: Once the software is deployed, the customers need to be supported. After listening to the section on deployment, click on the ‘continue’ button to listen to information about support.
-
1.2.3.7 Maintenance
Note: The deployed software needs to be maintained and upgraded as needed. Please click on the ‘continue’ button to listen to the section on maintenance.
- 1.3 Java
-
1.3.1 The History of Java Programming Language
- Reading: Freejavaguide.com: “History of Java Programming Language”
Link: Freejavaguide.com: “History of Java Programming Language” (HTML)
Instructions: Please read this article. Freejavaguide.com is a website designed to provide many online tutorials on the Java programming language.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Freejavaguide.com: “History of Java Programming Language”
-
1.3.2 High vs. Low Level Programming Languages
- Reading: Scribd: University College, Yaribu: “Lecture 2: High Level vs. Low Level Languages”
Link: Scribd: University College, Yaribu: “Lecture 2: High Level vs. Low Level Languages” (HTML)
Instructions: Please read this set of lecture notes. This link discusses the difference between the high-level and the low-level programming languages along with some examples. It also discusses the role of compilers, assemblers, and linkers.
Reading these lecture notes should take approximately 1 hour.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Scribd: University College, Yaribu: “Lecture 2: High Level vs. Low Level Languages”
-
1.3.3 Interpreted vs. Compiled Languages
- Reading: Wikibooks: “Compiler Construction/Introduction”
Link: Wikibooks: “Compiler Construction/Introduction” (PDF)
Instructions: This article defines a “compiler” and an “interpreter.” A compiler translates from one programming language to another. The translated program is saved and can be executed at a later time, hence the terms, “compile time” and “execution time.” An interpreter, on the other hand, translates a program and executes it at the same time. To execute it again, the interpreter would have to translate it again and then re-execute it. The following reading will elaborate on this distinction.
Reading this material and taking notes should take approximately 15 minutes.
Terms of Use: This resource is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. It is attributed to Wikibooks, and the original version can be found here.See a broken link? Please let us know!
- Reading: The Saylor Foundation’s “Translators: Compilers and Interpreters”
Link: The Saylor Foundation’s “Translators: Compilers and Interpreters” (PDF)
Instructions: This article elaborates on the distinction between compliers and interpreters.
Reading the linked material and taking notes should take approximately 15 minutes.
Terms of Use: This resource is licensed under a Creative Commons Attribution 3.0 License. It is attributed to The Saylor Foundation.See a broken link? Please let us know!
- Reading: Wikibooks: “Compiler Construction/Introduction”
-
1.3.4 Byte Code vs. Machine Code
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 5: Introduction to Java”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 5: Introduction to Java” (PDF)
Instructions: Please work through this tutorial. As you work through the notes, think about and answer the questions at the bottom of each page. Please note that this reading covers the topics outlined in sub-subunit 1.3.4 and parts of sub-subunit 1.3.5.
Studying this chapter should take approximately 1 hour and 30 minutes.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML or MP3). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Assessment: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Fill in the Blanks Exercise for Chapter 5”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Fill in the Blanks Exercise for Chapter 5” (PDF)
Instructions: Please think of the word to fill in the blank for each statement.
Completing this assessment should take approximately 30 minutes.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 5: Introduction to Java”
- 1.3.5 Compiling and Running a Simple Java Program
-
1.3.5.1 Downloading and Installing Java Development Kit (JDK)
- Reading: Nanyang Technological University’s “Downloading and Installing JDK”
Link: Nanyang Technological University’s “Downloading and Installing JDK” (HTML)
Instructions: Please use the above link to download and install the latest version of JDK. After installing JDK, read the instructions carefully to set the “classpath” mentioned in Step 3. Once JDK has been installed, you can write a simple Java program using an editor such as notepad and run it from a command prompt. Alternatively, Java programs can be written using an Integrated Development Environment (IDE) such as NetBeans. Please see the next subunit for information on downloading and installing NetBeans.
Completing this process should take approximately 1 hour.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Nanyang Technological University’s “Downloading and Installing JDK”
-
1.3.5.2 Installing NetBeans (IDE)
- Reading: Nanyang Technological University’s “Downloading and Installing NetBeans IDE”
Link: Nanyang Technological University’s “Downloading and Installing NetBeans IDE” (HTML)
Instructions: Please follow the instructions on the webpage to download and install NetBeans, a commonly used IDE for Java programming. After installing NetBeans, use instructions in Step 2 to write a simple Java program called “Hello.java.” Please write this program using NetBeans and then compile and run it.
Completing this process should take approximately 1 hour.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Nanyang Technological University’s “Downloading and Installing NetBeans IDE”
-
1.3.5.3 Java Application Programming Interface (API)
- Reading: The Saylor Foundation’s “Java Application Programming Interface (API)”
Link: The Saylor Foundation’s “Java Application Programming Interface (API)” (PDF)
Instructions: Please read this brief article about the Java API.
Reading this article should take approximately 15 minutes.
Terms of Use: This resource is licensed under a Creative Commons Attribution 3.0 License. It is attributed to The Saylor Foundation.See a broken link? Please let us know!
- Reading: The Saylor Foundation’s “Java Application Programming Interface (API)”
-
Unit 2: Object-Oriented Programming
Java is an Object-Oriented programming language. Since Object-Oriented programming (OO) is currently one of the most popular programming paradigms, you will need to learn its fundamental concepts in order to build a career in Computer Science. This unit will begin with a discussion of what makes OO programming so unique, and why its advantages have made it the industry-standard paradigm for newly-designed programs. We will then discuss the fundamental concepts of OO and relate them back to Java. By the end of this unit, you will have a strong understanding of what Object-Oriented programming is, how it relates to Java, and why it is employed.
Unit 2 Time Advisory show close
Unit 2 Learning Outcomes show close
- 2.1 Programming Language Design
-
2.1.1 Object-Oriented vs. Procedural
- Reading: Virtuosi Media: Benjamin Kuker’s “Procedural vs. OOP Explained”
Link: Virtuosi Media: Benjamin Kuker’s “Procedural vs. OOP Explained” (HTML)
Instructions: Please read this article. This article explains the difference between procedural languages and object-oriented programming languages.
Reading this article should take approximately 1 hour.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Virtuosi Media: Benjamin Kuker’s “Procedural vs. OOP Explained”
-
2.1.2 Advantages/Disadvantages of OO Programming
- Reading: The Saylor Foundation’s “Advantages and Disadvantages of Object-Oriented Programming (OOP)”
Link: The Saylor Foundation’s “Advantages and Disadvantages of Object-Oriented Programming (OOP)” (PDF)
Instructions: Please read this article about object-oriented programming.
Reading this article should take approximately 30 minutes.
Terms of Use: This resource is licensed under a Creative Commons Attribution 3.0 License. It is attributed to The Saylor Foundation.See a broken link? Please let us know!
- Reading: The Saylor Foundation’s “Advantages and Disadvantages of Object-Oriented Programming (OOP)”
- 2.1.3 Examples
-
2.1.3.1 Java
- Reading: Oracle’s The Java Tutorials: “What Is a Class?”
Link: Oracle’s The Java Tutorials: “What Is a Class?” (HTML)
Instructions: Please read this article. The Java Tutorials are practical guides for programmers who want to use the Java programming language to create applications. They include hundreds of complete, working examples, and dozens of lessons. Groups of related lessons are organized into “trails.” This tutorial from Oracle gives an overview of a class in Java.
Reading this article should take approximately 15 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Oracle’s The Java Tutorials: “What Is a Class?”
-
2.1.3.2 Python
- Reading: Python for Java Programmers: Rance Necaise’s “Defining Classes”
Link: Python for Java Programmers: Rance Necaise’s “Defining Classes” (HTML)
Instructions: Please read this article. Please note that the concept of classes is the same in different languages, though the syntax varies.
Reading this article should take approximately 2 hours.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Python for Java Programmers: Rance Necaise’s “Defining Classes”
-
2.1.3.3 C++
- Reading: Tenouk’s C and C++ Site: “Module 12: C++ Objects and Classes”
Link: Tenouk’s C and C++ Site: “Module 12: C++ Objects and Classes” (HTML)
Also available in:
PDF (Module12.pdf)
Instructions: Please click on the link above, scroll down the webpage to Section 12.3, and read this section. Please note that the concept of classes is the same in different languages, though the syntax varies.
Reading this section should take approximately 2 hours.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Tenouk’s C and C++ Site: “Module 12: C++ Objects and Classes”
-
2.2 Fundamental Concepts of OO Programming
- Reading: Hobart and William Smith Colleges: David J. Eck’s Introduction to Programming Using Java: “Section 1.5 Objects and Object-Oriented Programming”
Link: Hobart and William Smith Colleges: David J. Eck’s Introduction to Programming Using Java: “Section 1.5 Objects and Object-Oriented Programming” (HTML)
Also available in:
PDF (link on the bottom of the page)
Instructions: Please read this section. This section explains fundamentals of object oriented programming. Please note that this reading covers the topics for sub-subunits 2.2.1 – 2.2.3.
Reading this section should take approximately 1 hour.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Hobart and William Smith Colleges: David J. Eck’s Introduction to Programming Using Java: “Section 1.5 Objects and Object-Oriented Programming”
-
2.2.1 Classes vs. Objects
Note: Please pay special attention to the last section on the page to understand classes and objects.
-
2.2.2 Inheritance
Note: Please pay special attention to the last section on the page to understand the concept of inheritance.
-
2.2.3 Encapsulation
Note: Please pay special attention to the second section of the resource to understand the concept of encapsulation.
-
2.2.4 Polymorphism
- Reading: Niagra College: John Russell’s “Java Tutorial 5 – Inheritance and Polymorphism”
Link: Niagra College: John Russell’s “Java Tutorial 5 – Inheritance and Polymorphism” (HTML)
Instructions: This tutorial explains two very important concepts related to OO programming. Please read through the tutorial, concentrating on the section on polymorphism.
Reading this tutorial should take approximately 3 hours.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Niagra College: John Russell’s “Java Tutorial 5 – Inheritance and Polymorphism”
-
2.2.5 Decoupling
- Reading: The Saylor Foundation’s “Decoupling”
Link: The Saylor Foundation’s “Decoupling” (PDF)
Instructions: Please read this article.
Reading this article should take approximately 15 minutes.
Terms of Use: This resource is licensed under a Creative Commons Attribution 3.0 License. It is attributed to The Saylor Foundation.See a broken link? Please let us know!
- Reading: The Saylor Foundation’s “Decoupling”
-
Unit 3: Java Fundamentals
Now that you have a basic understanding of OO programming, we will move on to the fundamental concepts of the programming language we will be studying this semester: Java. The Java-related concepts you will learn in this unit are in many cases directly transferable to a number of other languages. We will begin by learning about “Hello World,” a basic software application that simply prints “Hello World” to the screen as a means of demonstrating the most essential elements of a programming language, and then move on to discuss the more fundamental concepts of variables, literals, data types, and operators. In addition, we will also learn about two different styles of adding comments to the code. By the end of this unit, you should have a fundamental understanding of Java basics and be prepared to utilize those concepts later in the course.
Unit 3 Time Advisory show close
Unit 3 Learning Outcomes show close
- 3.1 HelloWorld.java
-
3.1.1 Class and File Naming Conventions
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 6: Small Java Programs”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 6: Small Java Programs” (PDF)
Instructions: Please read through the first three pages of this chapter. These three pages discuss the naming conventions as well as the reserved words in Java programming language. If you wrote the Hello.java program as mentioned in sub-subunit 1.3.5.2, then this section might be a little review for you.
Reading these screens should take approximately 15 minutes.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML or MP3). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 6: Small Java Programs”
-
3.1.2 Importing Libraries
- Reading: The Saylor Foundation’s “Importing Libraries in Java”
Link: The Saylor Foundation’s “Importing Libraries in Java” (PDF)
Instructions: Please read this article. Java classes and interfaces can be organized into packages to group related types and for name-space management.
Reading this article should take approximately 30 minutes.
Terms of Use: This resource is licensed under a Creative Commons Attribution 3.0 License. It is attributed to The Saylor Foundation.See a broken link? Please let us know!
- Reading: The Saylor Foundation’s “Importing Libraries in Java”
-
3.1.3 Declaring a Class
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 6: Small Java Programs”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 6: Small Java Programs” (PDF)
Instructions: You first encountered this chapter in sub-subunit 3.1.1. Continue reading this chapter from page 4 to the end. Alternatively, you may decide to read the entire chapter, reviewing pages 1 – 3. The chapter discusses common syntax errors in Java as well as guidelines to fix those errors. The last section of this chapter provides instructions on adding comments inside Java code.
Reading this chapter should take approximately 2 hours.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML or MP3). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Assessment: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Fill in the Blanks Exercise for Chapter 6: Small Java Programs”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Fill in the Blanks Exercise for Chapter 6: Small Java Programs” (PDF)
Instructions: Please think of the appropriate answer to fill in the blank for each question.
Completing this assessment should take approximately 30 minutes.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 6: Small Java Programs”
-
3.1.4 Compiling and Executing a Java Program
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 7: Running Example Programs”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 7: Running Example Programs” (PDF)
Instructions: Please read through the chapter and follow all the steps. This chapter provides step-by-step instructions of writing a Java program using Notepad and then compiling and running this program from command prompt. We can also use NetBeans for writing the same program.
Reading this chapter and following the steps to write the Java program should take approximately 4 hours.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML or MP3). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Assessment: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Fill in the Blank Exercise for Chapter 7: Running Sample Programs”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Fill in the Blank Exercise for Chapter 7: Running Sample Programs” (PDF)
Instructions: Please complete the fill in the blank exercise. Think of the appropriate response to fill in the blanks.
Completing this assessment should take approximately 15 minutes.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 7: Running Example Programs”
- 3.2 Variables, Literals, and Primitive Data Types
-
3.2.1 Variables vs. Literals
- Reading: RoseIndia.net: “Java – Variable, Constant and Literal in Java”
Link: RoseIndia.net: “Java – Variable, Constant and Literal in Java” (HTML)
Instructions: Please read this article. This article explains the difference between variables and literals.
Reading this article should take approximately 15 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Web Media: YouTube: Khan Academy’s “Introduction to Programs, Data Types, and Variables”
Link: YouTube: Khan Academy’s “Introduction to Programs, Data Types, and Variables” (YouTube)
Instructions: Please watch the lecture for an introduction to programming basic data types. This is one of a group of Khan Lectures that are used in this course. All of these lectures demonstrate programming concepts using Python.
You have been introduced to Python in sub-subunit 2.1.3.2 on OO-Programming. Python is an interpreted programming language that can be used to write procedural or object-oriented programs. It is easy to understand and write Python programs. One of its distinctive features is that it is dynamically typed. This means that a declaration is not needed to declare the type of a name. The Python interpreter determines the type of a name at execution time. Programming languages have syntax and semantics. Syntax is the set of grammar rules for writing statements in the language. Semantics are the meanings attached to the statements. For the lecture series, concentrate on the semantics or meanings. It is not our intent to teach Python here, but to use Python to teach programming concepts.
The value of these lectures lies primarily in the programming concepts that they demonstrate. From sub-subunit 1.2.3, The Programming Lifecycle, you saw that programs are used to solve problems (called requirements) using a programming language. First, one must devise a plan for solving the problem (called the design of the program). Then, a solution must be built based on the design, using a programming language (called the implementation or program implementation)—in this lecture, Python programs. Finally, you should test the program to check that it solves the problem (i.e. satisfies the requirements).
In watching the lecture, focus on understanding the process of specifying the problem or requirements, the design, the program semantics, and test as well as understanding the transformation that relates these to each other. Do not worry about the syntax of Python for now; the basics will be repeated throughout the Khan lectures.
Watching the lecture and taking notes should take approximately 15 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: RoseIndia.net: “Java – Variable, Constant and Literal in Java”
-
3.2.2 Legality of Variable Names
- Reading: Oracle’s The Java Tutorials: “Variables”
Link: Oracle’s The Java Tutorials: “Variables” (HTML)
Instructions: Please read this article. This tutorial explains different kinds of variables in Java language. These include instance variables, class variables, and local variables. It also discusses the naming rules and conventions that are part of Java.
Reading this article should take approximately 30 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Oracle’s The Java Tutorials: “Variables”
-
3.2.3 Primitive Data Types
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 8: Primitive Data”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 8: Primitive Data” (PDF)
Instructions: Please read the chapter. This chapter discusses eight primitive data types in Java programming language. Please note that this resource applies to the topics outlined in sub-subunits 3.2.3.1 – 3.2.3.3.
Reading this chapter should take approximately 2 hours.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML or MP3). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Assessment: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Flash Cards on Primitive Data Types”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Flash Cards on Primitive Data Types” (PDF)
Instructions: Please note that this assessment covers the topics outlined in sub-subunits 3.2.3.1 – 3.2.3.3.
Completing this assessment should take approximately 30 minutes.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 8: Primitive Data”
- 3.2.3.1 Integers and Booleans
-
3.2.3.2 Chars and Strings
- Web Media: YouTube: Khan Academy’s “Python Lists” and “Fun with Strings”
Link: YouTube: Khan Academy’s “Python Lists” (YouTube) and “Fun with Strings” (YouTube)
Instructions: Please watch the two lectures. Lists and strings are similar, in that a string can be viewed as a list of characters. However, while similar, they are different objects with their own methods or functions used to manipulate them. A program consists of control phrases, or statements, and data structures. Lists and strings are two important data structures for problem solving.
Watching these lectures and taking notes should take approximately 30 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpages above.See a broken link? Please let us know!
- Web Media: YouTube: Khan Academy’s “Python Lists” and “Fun with Strings”
- 3.2.3.3 Floats, Doubles
-
3.3 Basic Operations in Java
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 9: Variables and Assignment Statements”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 9: Variables and Assignment Statements” (PDF)
Instructions: Please read the chapter. This chapter provides an overview of variables and arithmetic operations and order precedence in Java. Please note that this resource covers the topics outlined in sub-subunits 3.3.1 – 3.3.4.
Reading this chapter should take approximately 3 hours.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML or MP3). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Assessment: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz on Variables and Assignment”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz on Variables and Assignment” (PDF)
Instructions: Please work through the multiple-choice quiz. Please note that this assessment covers the topics outlined for sub-subunits 3.3.1 – 3.3.4.
Completing this assessment should take approximately 30 minutes.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 9B: Expressions and Arithmetic Operators”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 9B: Expressions and Arithmetic Operators” (PDF)
Instructions: Please read the chapter. This chapter discusses arithmetic operations in greater detail along with solving expressions with mixed data types. Please note that this covers the topics outlined in sub-subunits 3.3.1 – 3.3.4.
Reading this chapter should take approximately 2 hours.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML or MP3). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Assessment: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz on Expressions”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz on Expressions” (PDF)
Instructions: Please work through the multiple-choice quiz. Please note that this quiz covers the topics outlined in sub-subunits 3.3.1 – 3.3.4.
Completing this assessment should take approximately 30 minutes.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 9: Variables and Assignment Statements”
-
3.3.1 Declaration Operators
Note: Pay attention to the text below the headings “Arithmetic Operators,” “Integer Operators,” and “Floating Point Operators.”
-
3.3.2 Arithmetic Operators
Note: Pay attention to the text below the heading “Arithmetic Operators” to learn about various arithmetic operators in Java.
-
3.3.3 Assignment Operators
- Reading: The Saylor Foundation’s “Assignment Operators”
Link: The Saylor Foundation’s “Assignment Operators” (PDF)
Instructions: Please read this article.
Reading this article should take approximately 30 minutes.
Terms of Use: This resource is licensed under a Creative Commons Attribution 3.0 License. It is attributed to The Saylor Foundation.See a broken link? Please let us know!
- Reading: The Saylor Foundation’s “Assignment Operators”
-
3.3.4 Typecasting
Note: Pay attention to the text below the heading “Mixed Floating Point and Integer Expressions,” and read the next three slides. Though the text in these slides do not mention it explicitly, the conversion of one type of data (integers in the example) to another type of data (floating point in the example) is automatically done by the compiler and is referred to as “type-casting” or simply “casting.”
-
3.4 String Class
- Reading: Oracle’s The Java Tutorials: “String”
Link: Oracle’s The Java Tutorials: “String” (HTML)
Instructions: Please read this article. In Java, String is a class and this tutorial explains how Strings can be created and manipulated.
Reading this article should take approximately 30 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Web Media: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 29: String and Object References” and “Chapter 29B: More about Strings”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 29: String and Object References” (PDF) and “Chapter 29B: More about Strings” (PDF)
Instructions: Please read through Chapter 29 and Chapter 29B. These chapters discuss the String class, which is used for text manipulation. As you read these chapters, you will learn different ways to create Strings, methods to manipulate Strings, the String concatenation operator ‘+,’ as well as the fact that the Strings are immutable.
Reading these chapters and taking notes should take approximately 3 hours and 30 minutes.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here and here. Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Reading: Oracle’s The Java Tutorials: “String”
-
Unit 4: Relational and Logical Operators in Java
In this unit, we will discuss relational and logical operators in Java, which provide the foundation for topics like control structures (which we will discuss further in Unit 5). In this unit, we will start by taking a look at operator notation. We will then discuss relational operators as they apply to both numeric operands and object operands before concluding the unit with an introduction to logical operators. By the end of this unit, you should be able to perform comparisons and logic functions in Java and have a fundamental understanding of how they are employed.
Unit 4 Time Advisory show close
Unit 4 Learning Outcomes show close
-
4.1 Operator Notations
- Reading: The Saylor Foundation’s “Operator Notation”
Link: The Saylor Foundation’s “Operator Notation” (PDF)
Instructions: Please read this article. Note that this reading covers the topics outlined in sub-subunits 4.1.1 – 4.1.3.
Terms of Use: This resource is licensed under a Creative Commons Attribution 3.0 License. It is attributed to The Saylor Foundation.See a broken link? Please let us know!
- Reading: The Saylor Foundation’s “Operator Notation”
-
4.1.1 Infix Notations
Note: This topic is covered by the subunit 4.1. Please focus on the text below "Inflix Notation" on the first page.
-
4.1.2 Postfix Notations
Note: This topic is covered by subunit 4.1. Please focus on the text below "Postfix Notation" on the second page.
-
4.1.3 Prefix Notations
Note: This topic is covered by subunit 4.1. Please focus on the text below "Prefix Notation" on the first page.
-
4.2 Relational Operators
- Reading: Austin Community College: Richard Baldwin’s “Java Programming Lecture Notes #22: Operators”
Link: Austin Community College: Richard Baldwin’s “Java Programming Lecture Notes #22: Operators” (HTML)
Instructions: Please select the “Relational and Conditional (Logical) Operators” link in the table of contents, and read this section to learn about binary relational operators. In addition, this section also compares the operators used in Java with operators in C++. Please note that this reading applies to the topics outlined in sub-subunits 4.2.1 – 4.2.6.
Reading this section should take approximately 1 hour.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Austin Community College: Richard Baldwin’s “Java Programming Lecture Notes #22: Operators”
-
4.2.1 Greater Than
Note: This topic is covered by the resource under subunit 4.2.
-
4.2.2 Less Than
Note: This topic is covered by the resource under subunit 4.2.
-
4.2.3 Equal To
Note: This topic is covered by the resource under subunit 4.2.
-
4.2.4 Not Equal To
Note: This topic is covered by the resource under subunit 4.2.
-
4.2.5 Greater Than or Equal To
Note: This topic is covered by the resource under subunit 4.2.
-
4.2.6 Less Than or Equal To
Note: This topic is covered by the resource under subunit 4.2.
- 4.3 Logical Operators
-
4.3.1 Uses
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 14: Boolean Expressions”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 14: Boolean Expressions” (PDF)
Instructions: Please read the chapter. This chapter covers relational and logical operators. It also discusses the use of these operators to write Boolean expressions. Please note that this reading covers the topics outlined in sub-subunits 4.3.1 – 4.3.3.
Reading this chapter should take approximately 3 hours.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML or MP3). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Assessment: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Fill in the Blanks Exercise for Boolean Expressions”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Fill in the Blank Exercise for Boolean Expressions” (PDF)
Instructions: Please complete this fill in the blank exercise. Think of the response to fill in the blank or to answer true/false, or write your response down. Then, click on the box to reveal the answer to each question. Please note that this exercise applies to the topics outlined in sub-subunits 4.3.1 – 4.3.3.
Completing this assessment should take approximately 30 minutes.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 14: Boolean Expressions”
-
4.3.2 Comparing Boolean Values
Note: In particular, read the first five pages of this resource to understand how two Boolean expressions are compared.
-
4.3.3 NOT, OR, AND
Note: Please read all the pages in this tutorial to understand the logical operators and how they are used. Please try the examples that are discussed while explaining these operators.
-
4.3.4 Truth Tables
- Web Media: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 40B: Truth Tables and De Morgan’s Rules”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 40B: Truth Tables and De Morgan’s Rules” (PDF)
Instructions: Please read the chapter. This chapter discusses Boolean expressions in greater detail as well as use of these expressions of writing conditional and looping statements.
Reading this chapter should take approximately 2 hours.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML or MP3). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Assessment: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Review of Truth Tables and De Morgan’s Rules”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Review of Truth Tables and De Morgan’s Rules” (PDF)
Instructions: Please answer all of the questions in the review. It may help to write your answers down on a separate piece of paper. After you have thought of your answer, only then click on the box in each question to reveal the correct answer.
Completing this assessment should take approximately 30 minutes.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Web Media: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 40B: Truth Tables and De Morgan’s Rules”
-
Unit 5: Control Structures and Arrays
Control structures dictate what the behavior of a program will be under what circumstances. Control structures belong to one of two families: those that test values and determine what code will be executed based on those values, and those that loop, performing identical operations multiple times. Control structures like if-then-else and switchtell the program to behave differently based on the data that they are fed. The while and for loops allow you to repeat a block of code as often as it is needed. As you can see, that functionality can be very useful when designing complex programs. This unit will introduce you to control structures and the ways in which they are used before moving on to discuss if, switch, while/do-while, and for loops. We will also discuss some advanced topics, such as nesting and scope. Arrays are discussed in the last subunit of this unit. An Array is a fixed-size data structure that allows elements of same data type to be stored in it. By the end of this unit, you should be able to draw from the information you learned in the previous unit to create a control structure, which will allow you to create more complex and useful programs.
Unit 5 Time Advisory show close
Unit 5 Learning Outcomes show close
-
5.1 Introduction to Control Structures
- Reading: Learnola.com’s “Beginning Java Tutorial – Methods – Control Structures”
Link: Learnola.com’s “Beginning Java Tutorial – Methods – Control Structures” (HTML)
Instructions: Please read through the entire page. Please note that this reading applies to sub-subunits 5.1.1 and 5.1.2.
Reading this article should take approximately 1 hour.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Learnola.com’s “Beginning Java Tutorial – Methods – Control Structures”
-
5.1.1 Motivations
Note: Please read the first three paragraphs of the reading. They explain how control structures can transfer the execution of a sequential code to some other part of the program based on user input or some other value.
-
5.1.2 Types
Note: There are various kinds of control structures such as conditional statements, loops, and methods that control the flow of a program. Please read the sections under headings “Conditional,” “Loops in Java,” and “Methods” to understand more about the types of conditional structures in Java. Different type of control structures are discussed in greater detail in subunit 5.2.
-
5.2 The ‘if’ statement
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 12: Decision Making”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 12: Decision Making” (PDF)
Instructions: Please read this chapter. This chapter discusses how computer can make decisions using an if statement. Please note that this reading applies to the topics outlined in sub-subunits 5.2.1 and 5.2.2.
Reading this chapter should take approximately 2 hours.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML or MP3). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Assessment: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz on the If Statement”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz on the If Statement” (PDF)
Instructions: Please work through the quiz. Please note that this assessment applies to sub-subunits 5.2.1 and 5.2.2.
Completing this assessment should take less than 30 minutes.
Terms of Use: This resource has been reposted with the kind permission of Bradley Kjell, and the original version can be found here (HTML). Please note that this material is under copyright and cannot be reproduced in any capacity without the explicit permission from the copyright holder.See a broken link? Please let us know!
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 12: Decision Making”
-
5.2.1 Uses
Note: As you read this tutorial, you will understand that sometimes it is important to evaluate the value of an expression and perform a task if the value comes out to be true and another task if it is false. In particular, try the simulated program under the heading “Simulated Program” to see how a different response is presented to the user based on if a number is positive or negative.
-
5.2.2 General ‘if-then-else’ Structure in Java
Note: Pay special attention to the reading under the heading “More Than One Statement per Branch” to learn how the ‘else’ statement is used when there is more than one choice.
-
5.3 The ‘switch’ Statement
- Web Media: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 43: More Ways to Make Decisions”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 43: More Ways to Make Decisions” (HTML)
Instructions: Please read the chapter. This chapter discusses switch statement and ‘?’ operator to write conditional statement. Please note that this reading applies to the topics outlined for sub-subunits 5.3.1 and 5.3.2.
Reading this chapter should take approximately 2 hours.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Assessment: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz on the Conditional Operator and the Switch Statement”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz on the Conditional Operator and the Switch Statement” (HTML)
Instructions: Please work through the quiz. Click on the grade quiz button at the end. Please note that this applies to sub-subunits 5.3.1 and 5.3.2.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Web Media: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 43: More Ways to Make Decisions”
-
5.3.1 Uses
Note: As you read this tutorial, you will learn that sometimes it is better to use a ‘switch’ statement when there are multiple choices to choose from. Under such conditions, an if/else structure can become very long and at times difficult to comprehend. Please read the section under the heading “Many-way Branches,” and pay special attention to the syntax of the ‘switch’ statement.
-
5.3.2 Relationship to ‘if’
Note: Once you have read the entire tutorial, you will understand the similarity of the logic used for the ‘if/else’ statement and ‘switch’ statement and how they can be used alternately.
-
5.4 The ‘while’ and ‘do-while’ Loops
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 15: Loops and the While Statement”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 15: Loops and the While Statement” (HTML or MP3)
Instructions: Please read this chapter. Make sure to click on the arrows to navigate through these webpages. You may also click on the sound icon at the top of the webpage to listen to the MP3. This chapter explains while loop. Please note that this reading applies to sub-subunits 5.4.1 and 5.4.2.
Reading this chapter should take approximately 2 hours.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Web Media: Khan Academy’s “While Loops”
Link: Khan Academy’s “While Loops” (YouTube)
Instructions: Please watch this 6-minute lecture. This lecture explains loops by applying them to a simple application, manipulating lists. Though the video uses Python programming language to explain the while loop, the basic concept of the while loop remains the same. The while loop requires a statement in the body of the loop that updates the control variable. In the next section, we will learn about the ‘for’ loop, which is another implementation of a loop, where the control is automatically updated.
Watching this lecture and taking notes should take approximately 10 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Assessment: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Fill in the Blank Exercise For Loops and the While Statement”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Fill in the Blank Exercise For Loops and the While Statement” (HTML)
Instructions: Please complete the fill in the blank exercise. Think of the correct response to fill in the blank for each question, or write your response down on a separate piece of paper. Then, click on the blank to reveal the correct answer.
Completing this assessment should take approximately 30 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 44: The Daring Do Statement”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 44: The Daring Do Statement” (HTML)
Instructions: Please read this chapter. This chapter discusses the do loop, which is a variation of the while loop. Please note that this resource applies to the topics outlined in sub-subunits 5.4.1 and 5.4.2.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Assessment: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz on the do Statement”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz on the do Statement” (HTML)
Instructions: Please work through the quiz. Click on the “Grade Quiz” button at the end to see how many questions you answered correctly as well as to reveal the correct answers. Please note that this assessment applies to sub-subunits 5.4.1 and 5.4.2.
Completing this assessment should take approximately 30 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 15: Loops and the While Statement”
-
5.4.1 Uses
Note: After reading the tutorial, you will understand how a do-while loop works. In a do-while loop, the body of the loop is executed at least one time, whereas in a while loop, the loop may never execute if the loop condition is false. Please read the pages starting with the heading “Bottom Driven Loop” to understand the advantages of this loop.
-
5.4.2 ‘while’ vs. ‘do-while’
Note: At the end of this tutorial, you will understand the difference between while and do-while loops. They both are essentially the same except that the while loop is a pre-test loop and may never execute if the condition is false to begin with. On the other hand, the do-while loop is a post-test loop and always executes at least one time, even if the condition is false.
-
5.5 The ‘For’ Loop
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 41: The Fantastic For Statement”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 41: The Fantastic For Statement” (HTML or MP3)
Instructions: Please read this chapter. This chapter discusses for loop. This loop is more compact than the while and do loops and automatically updates the loop counter at the end of each iteration. Please note that this resource applies to the topics outlined in sub-subunits 5.5.1 and 5.5.2.
Reading this chapter should take approximately 1 hour and 30 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Web Media: Khan Academy’s “For Loops in Python”
Link: Khan Academy’s “For Loops in Python” (YouTube)
Instructions: Please watch the 11-minute lecture. This lecture explains loops by applying them to a simple application, manipulating lists. Unlike the while loop, the for loop does not require a statement in the body of the loop that updates the control variable. Please note that the for loop is explained using Python programming language.
Watching this lecture and taking notes should take approximately 15 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Assessment: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz on For Loops”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz on For Loops” (HTML)
Instructions: Please work through the quiz. Click on the “Grade Quiz” button at the end to see how many answers you got correct as well as to reveal the correct answers. Please note that this assessment applies to sub-subunits 5.5.1 and 5.5.2.
Completing this assessment should take approximately 30 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 42: More about the For Statement”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 42: More about the For Statement” (HTML)
Instructions: Please read this chapter. Make sure to click on the arrow buttons to navigate to each webpage. You may also click on the sound icon at the top of the webpage to listen to the MP3. This chapter discusses the for loop in greater detail as well as the scope of variables in the for loop. Please note that this resource applies to the topics outlined in sub-subunits 5.5.1 and 5.5.2.
Reading this chapter should take approximately 1 hour.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Assessment: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz on Further For Loops”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz on Further For Loops” (HTML)
Instructions: Please work through the quiz. Click on the “Grade Quiz” button at the end to see how many answers you got correct as well as to reveal the correct answers for each question. Please note that this assessment applies to sub-subunits 5.5.1 and 5.5.2.
Completing this assessment should take approximately 30 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 41: The Fantastic For Statement”
-
5.5.1 Uses
- Web Media: Khan Academy’s “Writing a Simple Factorial Program,” “Stepping through the Factorial Program,” and “Flowchart for the Factorial Program”
Link: Khan Academy’s “Writing a Simple Factorial Program” (YouTube), “Stepping through the Factorial Program” (YouTube), and “Flowchart for the Factorial Program” (YouTube)
Instructions: Please click on the first link above, and watch the 8-minute lecture. This lecture uses a for loop to calculate the factorial of a natural number greater than or equal to 0. Remember to focus on the design or algorithm of the program and the semantics of the program statements.
Then, click on the second link above, and watch the 9-minute lecture to note how Khan verifies the program by stepping through it. In the previous video, he also ran it several times to check it out.
Finally, click on the third link above, and watch the 6-minute lecture. In this lecture, Khan documents the design of the factorial program by flowcharting it; this is the design of the program, which logically is done before writing the program.
Watching these lectures and taking notes should take approximately 30 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Web Media: Khan Academy’s “Writing a Simple Factorial Program,” “Stepping through the Factorial Program,” and “Flowchart for the Factorial Program”
-
5.5.2 Comparison to ‘while’ and ‘do-while’
Note: After completing sub-subunit 5.5.1, you will have clear understanding of how a for loop is used and some of its advantages. At this point you will be able to compare the for loop to while and do-while loops.
- 5.6 Advanced Topics
-
5.6.1 Nesting Control Structures
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 17: Nesting Loops and Ifs”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 17: Nesting Loops and Ifs” (HTML or MP3)
Instructions: Please read this chapter. Make sure to use the arrow keys to navigate through the webpages. You may also click on the sound icon at the top of the page to listen to the MP3. This chapter discusses how control structures such as loops and if statements can be combined together to implement program logic.
Reading this chapter should take approximately 2 hours.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Assessment: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Fill in the Blanks Exercise for Nested Loops and Ifs”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Fill in the Blanks Exercise for Nested Loops and Ifs” (HTML)
Instructions: Please complete the fill in the blanks exercise. Think of the correct response to fill in the blank, or write your answer down on a separate piece of paper. Then, click on the blank to reveal the correct answer.
Completing this assessment should take approximately 30 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 17: Nesting Loops and Ifs”
-
5.6.2 Variable Scope within a Control Structure
- Reading: Hobart and William Smith Colleges: David Eck’s “Introduction to Programming using Java: Section 3.1 Blocks, Loops, and Branches”
Link: Hobart and William Smith Colleges: David Eck’s “Introduction to Programming using Java: Section 3.1 Blocks, Loops, and Branches” (HTML)
Also available in:
PDF (scroll down to the bottom link)
Instructions: Please read the entire webpage. This webpage explains the variable scope in different control structures such as a block, while loop, and branching statement such as the if statement.
Reading this article should take approximately 1 hour.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Hobart and William Smith Colleges: David Eck’s “Introduction to Programming using Java: Section 3.1 Blocks, Loops, and Branches”
- 5.7 Arrays
-
5.7.1 Introduction to Arrays
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 46: Arrays”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 46: Arrays” (HTML or MP3)
Instructions: Please read this chapter. Make sure to use the arrow keys to navigate through the webpages. You may also click on the sound icon at the top of the page to listen to the MP3. This chapter introduces Arrays, a common data structure that is used to store data of same type.
Reading this chapter should take approximately 1 hour and 30 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 46: Arrays”
-
5.7.2 Common Array Algorithms
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 47: Common Array Algorithms”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 47: Common Array Algorithms” (HTML or MP3)
Instructions: Please read this chapter. Make sure to use the arrow keys to navigate through the webpages. You may also click on the sound icon at the top of the page to listen to the MP3. This chapter discusses how a for loop can used to iterate over the elements of an array. In addition, it also discusses enhanced for loop. The chapter demonstrates use of arrays to solve common problems such as finding sum, average, maximum, and minimum values of numbers stored in array. Please pay attention to some of the common programing errors one can make while using arrays.
Reading this chapter should take approximately 2 hours.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 47: Common Array Algorithms”
-
Unit 6: Exception Handling and Java I/O
In this unit, we will discuss two important programming concepts in Java: exception handling as well as input and outpout. Exception handling mechanism allows a program to continue executing, even if an error occurs in the program, instead of terminating it abruptly. Input and output techniques allow programmers to design more complex and useful programs. For this reason, you must fully understand how to use a programming language's built-in I/O (input/output) functionality. In this unit, we will discuss function I/O in Java before moving on to file I/O: both writing and reading data to and from files. Each unit will contain a discussion of the applicable Java classes, which are part of the standard programming language – FileWriter, PrintWriter, FileReader, BufferedReader, and IOException. We will then identify the common pitfalls and design concepts that you should keep in mind as a programmer. By the end of this unit, you will have a strong understanding of how to call functions from other functions, how to write and read from a file, and how to write a Java program that performs those functions.
Unit 6 Time Advisory show close
Unit 6 Learning Outcomes show close
-
6.1 Method Syntax in Java
- Reading: MIT Open Courseware: Dr. George Kocur’s Introduction to Computing and Engineering Problem Solving: “Lecture 6: Methods, Scope”
Link: MIT Open Courseware: Dr. George Kocur’s Introduction to Computing and Engineering Problem Solving: “Lecture 6: Methods, Scope” (PDF)
Instructions: Please download the PDF, and review these lecture notes. This reading will also cover the topics outlined in sub-subunits 6.1.1 – 6.1.4.
Reading these lectures notes should take approximately 1 hour.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Web Media: Khan Academy’s “Defining a Factorial Function,” “Diagramming What Happens with a Function Call,” “Recursive Factorial Function,” and “Comparing Iterative and Recursive Factorial Functions”
Link: Khan Academy’s “Defining a Factorial Function” (YouTube), “Diagramming What Happens with a Function Call” (YouTube), “Recursive Factorial Function” (YouTube), and “Comparing Iterative and Recursive Factorial Functions” (YouTube)
Instructions: Please click on the first link above, and watch the 10-minute lecture, which implements factorial as a function. Please note that a ‘method’ is often referred to as ‘function’ in some programming languages. The above resource uses the term ‘function’ instead of ‘method’ as the concepts are explained using Python.
Next, click on the second link above to watch “Diagramming What Happens with a Function Call.” The second video (10 minutes) verifies the function design by manually diagramming what happens statement by statement and function call by function call. This lecture also introduces variable scoping.
Then, please click on the link to “Recursive Factorial Function.” This third video (8 minutes) introduces recursion by implementing the factorial function using recursion. If you are familiar with proof by induction in mathematics, you will notice its conceptual similarity with recursion. Some verification is done by running the program for several cases.
Finally, select the link for the “Comparing Iterative and Recursive Factorial Functions” video. The fourth video (6 minutes) compares the loop implementation with the recursive implementation of the factorial function by stepping through them, side by side, using the same example inputs.
Please note that though these video lectures use Python programming language to explain methods/functions, the basic idea of method and method call is the same in Java programming language.
Watchin these lectures and taking notes should take approximately 45 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpages above.See a broken link? Please let us know!
- Reading: MIT Open Courseware: Dr. George Kocur’s Introduction to Computing and Engineering Problem Solving: “Lecture 6: Methods, Scope”
-
6.1.1 Function Declaration
Note: Pages 1-2 of the reading in 6.1 explain how a method is declared in Java.
-
6.1.2 Function Parameters
Note: Method parameters are explained on page 2. Method parameters are also referred to as ‘arguments’ as written in the slides.
-
6.1.3 Return Types
Note: As you read the section, you will learn that some methods do not return any value, while others return a value of certain data type. A method that does not return a value uses the keyword ‘void’ in the method signature.
-
6.1.4 Scope
Note: Read pages 4, 5, and 6 to learn about the scope of a variable.
-
6.2 Exception Handling
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 80: Exceptions”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 80: Exceptions” (HTML or MP3)
Instructions: Please read through the tutorial. Click on the arrow keys to navigate to each webpage. You may click on the sound icon at the top of the webpage to listen to the MP3. Note that the resource also covers the topics outlined for sub-subunits 6.2.1 – 6.2.4.
Reading this chapter should take approximately 2 hours and 30 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Web Media: YouTube: The New Boston’s “Exception Handling”
Link: YouTube: The New Boston’s “Exception Handling” (YouTube)
Instructions: Please watch this video as it demonstrates the use of try and catch blocks to catch exceptions in a simple Java program. Note that this resource also covers the topic outlined in sub-subunit 6.2.3.
Watching this video and pausing to take notes should take approximately 15 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 80: Exceptions”
-
6.2.1 Exception and Errors
Note: Both exceptions and errors disrupt the normal execution of a program and halt the program abruptly. Please read first three pages of the resource to understand the difference between exception and error.
-
6.2.2 Throwable Class
Note: In Java, all exceptions are derived from a class called “throwable.” Please read first three pages of the resource to understand the hierarchy of exception handling classes.
-
6.2.3 Try and Catch Blocks
Note: At the very core of exception handling mechanism are the key words try and catch. They both work together to catch problems in a program. Read the full tutorial provided in 6.2 as well as view the video by The New Boston to understand how the try and catch blocks are used to handle problems in the code.
-
6.2.4 Stack Trace
Note: Once an execution of a program stops due to a problem, JVM’s default exception handler terminates program execution and displays an error message followed by a list of method calls that lead to the exception. This is referred to as stack trace. Please review the resource provided under subunit 6.2 to understand stack trace and how it is printed.
- Assessment: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz on Exceptions and Errors”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz on Exceptions and Errors” (HTML)
Instructions: Please complete the multiple-choice quiz. After you have answered each question, click on the “Grade Quiz” button to see how many answers you got correct. Note that the correct answer will appear below each question.
Completing this assessment should take approximately 30 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Assessment: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz on Exceptions and Errors”
-
6.3 Input/Output in Java
- Web Media: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 10: Input and Output”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 10: Input and Output” (HTML or MP3)
Instructions: Please read through the tutorial. Click on the arrow keys to navigate to each webpage. You may click on the sound icon at the top of the webpage to listen to the MP3. Please note that this resource applies to the topics outlined for subunits 6.3.1 and 6.3.2.
Reading this chapter should take approximately 2 hours.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Assessment: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Fill in the Blanks Exercise for Input and Output”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Fill in the Blanks Exercise for Input and Output” (HTML)
Instructions: Please complete the fill in the blanks exercise. Think of the best response to fill in the blanks for each question, or you may write your answer down on a separate sheet of paper. After thinking of the answers, click on the blank in each question to reveal the correct response.
Completing this assessment should take approximately 30 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Web Media: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 10: Input and Output”
-
6.3.1 Standard I/O
Note: Please read pages 1 to 4 to learn about the Standard I/O classes in Java. You will learn about the Scanner class that is used to get input from the user. Page 4 discusses three more I/O classes that are used to get input/ouput from the user.
-
6.3.2 Common I/O Classes and Operations
Note: Please read page 5 onwards till the end to learn about various methods from the Scanner class that convert user input into appropriate data type before conducting any operation on the data. Study and run the program called ‘Echo.java’ to understand the use of these classes and the program’s methods.
-
6.3.3 String Formation
- Reading: The Saylor Foundation’s “String Formation”
Link: The Saylor Foundation’s “String Formation” (PDF)
Instructions: Please read this article.
Reading this article should take approximately 1 hour.
Terms of Use: This resource is licensed under a Creative Commons Attribution 3.0 License. It is attributed to The Saylor Foundation.See a broken link? Please let us know!
- Reading: The Saylor Foundation’s “String Formation”
- 6.4 Writing Data to a File
-
6.4.1 The FileWriter Class in Java
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 83: Writing Text Files”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 83: Writing Text Files” (HTML)
Instructions: Please read through the chapter. Make sure to use the arrow keys to navigate to each webpage.
Reading this chapter should take approximately 2 hours.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Assessment: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz on Writing Text Files”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz on Writing Text Files” (HTML)
Instructions: Please work through the quiz. Click on the “Grade Quiz” button at the end to see how many answers you got correct as well as to reveal the correct answers for each question.
Completing this assessment should take approximately 30 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 83: Writing Text Files”
-
6.4.2 The PrintWriter Class in Java
- Reading: Java Samples: Abinaya’s “Using PrintWriter in Java”
Link: Java Samples: Abinaya’s “Using PrintWriter in Java” (HTML)
Instructions: Please read through the tutorial.
Reading this tutorial should take approximately 30 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Reading: Java Samples: Abinaya’s “Using PrintWriter in Java”
-
6.5 Reading Data from a File
- Web Media: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 84: Reading from Text Files”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 84: Reading from Text Files” (HTML)
Instructions: Please read through the chapter. Make sure to use the arrow keys to navigate to each webpage. Please note that this resource will also cover the topics outlined in sub-subunits 6.5.1 and 6.5.2.
Reading this chapter should take approximately 1 hour and 30 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Assessment: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz on FileReader and BufferedReader”
Link: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Quiz on FileReader and BufferedReader” (HTML)
Instructions: Please work through the quiz. Click on the “Grade Quiz” button at the end to see how many answers you got correct as well as to reveal the correct answer to each question. Please note that this assessment applies to sub-subunits 6.5.1 and 6.5.2.
Completing this assessment should take approximately 30 minutes.
Terms of Use: Please respect the copyright and terms of use displayed on the webpage above.See a broken link? Please let us know!
- Web Media: Central Connecticut State University: Bradley Kjell’s Introduction to Computer Science Using Java: “Chapter 84: Reading from Text Files”
-
6.5.1 The FileReader Class in Java
Note: This tutorial explains the Java I/O API and discusses Reader classes in detail. The second page shows Reader Stream class hierarchy. FileReader and BufferedReader classes are used together when reading data from an external file. Please study the example on page 4 to see how these classes are used. Also, copy and paste the code on page 4 in a newNetBeans file, and run the program on your machine.
-
6.5.2 The BufferedReader Class in Java
Note: Please read page 4 to learn about BufferedReader class. The use of this class allows data to be buffered as it is read from the file before manipulating it.
-
Final Exam
- Final Exam: The Saylor Foundation's “CS101 Final Exam”
Link: The Saylor Foundation's “CS101 Final Exam”
Instructions: You must be logged into your Saylor Foundation School account in order to access this exam. If you do not yet have an account, you will be able to create one, free of charge, after clicking the link.See a broken link? Please let us know!
- Final Exam: The Saylor Foundation's “CS101 Final Exam”
Questions? Consult the FAQ's!


