Site Navigation

Site Search

Chapter 1: Introduction to Computers and Java

Learning Objectives

After completion of this chapter, you should be able to

Explain why it is helpful to study computer programming

Learning how to program is more than just writing code. It is really about computational thinking. Computational thinking is hard to define, but at its core is careful reasoning about methods of doing things. Another name for methods is algorithms.

Many consider computational thinking as a fundamental skill on par with reading, writing, and arithmetic.

Describe the early failures, successes and characteristics of the Java Programming Language

Java was designed by Sun Microsystems in the early 1990s develop a new technology for programming next generation smart appliances, which Sun expected to be a major new opportunity.

Java's Early Failures

Java's Success

Java Characteristics

Java was successful, both because of Sun's persistence marketing, but also because there was a need for a language with its characteristics.

Explain the difference between Java applications, Java applets, and JavaServer web pages

Java is used by programmers to write several types of applications

Explain the steps involved in creating computer programs

We can view programs as a complete set of instructions (known as an algorithm) to accomplish some task.

The level of detail of the instructions depends ... (on a lot of things)

Know the difference between machine language, assembly language, and high-level programming languages.

There are four programming language levels

  1. Machine language (uses binary representation)
  2. Assembly language (CS 311 at Central)
  3. High-level languages
    • COBOL, FORTRAN, Pascal, and C (procedural paradigm)
    • Smalltalk, C++ and Java (object-oriented paradigm)
    • LISP and Scheme (functional paradigm)
  4. Fourth-generation languages (database Structured Query Language SQL, Visual Basic controls)

Explain how abstraction relates to programming

The level of abstraction increases with each programming language level.

High-level programming languages allow programmers to write instructions at a high level of abstraction with less low-level detail.

Object-oriented (OO) languages allow programmers to add new abstractions to the programming language. This is similar to creating new words to stand for complicated concepts in English.

In Java, these new high-level abstractions are referred to as classes. When we use these high-level abstractions (classes) in programs, we call them objects.

Read and understand simple Java Programs

The Java Developers Kit (JDK) is a collection of free software available from Sun containing the Java compiler (javac.exe) and Java Virtual Machine (java.exe).

jGRASP is a programming editor and environment that allows you to type in your source code program, compile it using the Java compiler, and run it using the Java Virtual Machine.

jGRASP's toolbars and menus provide a convenient way to access the Java JDK. While, we could access the Java JDK through commands entered at a DOS prompt, combining editing, compiling, debugging, and execution into one integrated development environment (IDE) simplifies the process.

Recognize the elements common to all programming languages

Most programming languages share a set of common elements

Understand the elements in a simple Hello World Program

// My first program
public class HelloWorld
   public static void main (String[ ] args)
      String message = "Hello World" ;
      System.out.println( message ) ;

Understand the fundamental concepts of object-oriented programming

A programming language specifies the words, symbols and rules that we can use to write a program (the syntax).

Java Programs are object-oriented programs and

Read and understand an object-oriented sample Java class

public class Car
   private double gallonsLeft;

   public void drive ( )
      System.out.println ("Here I go ... HONK HONK ... You moron!");
      gallonsLeft = 0.0;
   public void fillErUp( )
      gallonsLeft = 24.5;

Explain the role of the Java compiler and Java Virtual Machine

The Java compiler translates Java source code into a special representation called bytecode. Java bytecode is not the same as machine language designed to run on a particular CPU, but a general low-level language designed to run on the Java Virtual Machine.

Another software tool, called the Java Virtual Machine, takes the Java bytecode and executes it on the particular computer.

Therefore, both the Java compiler and bytecode are not tied to any particular CPU or machine. We call this being architecturally-neutral. In theory, write-once and run everywhere: Platform independence

Prepare for Lab 1

Link to Lab 1