Chapter 1
Introduction

   1.1 Programs
   1.2 Programming Languages
   1.3 Why Java?
   1.4 Programming
   1.5 Course Objectives
   1.6 The Life of Programmers
   1.7 Assignment #1: APIs

1.1 Programs

A program is a set of instructions for processing data.

class sum { 
  public static void main (String[] args)  { 
    System.out.println( "Type 2 integer values: "); 
    System.out.println( readInt() + readInt() ); 
  } 
  static int readInt(){ 
       int digit, num; 
     digit = readCh(); 
     while( (digit < '0') || (digit>'9') ){ 
       digit = readCh(); 
     } 
     num = digit - '0';        digit = readCh(); 
     while( (digit>='0') && (digit<='9') ){ 
       num = num * 10 + digit - '0'; 
       digit = readCh(); 
     } 
     return num; 
  } 
  static int readCh(){ 
       int ch; 
     try{ ch = System.in.read(); } 
     catch ( java.io.IOException e ){ 
        System.out.println("input error"); 
     } 
     return ch; 
  } 
} 

1.2 Programming Languages

A programming language consists of

class hello { 
  public static void main (String[] args) { 
    System.out.println("Hello, world!"); 
  } 
} 

1.3 Why Java?

1.4 Programming

With good designs, coding turns out to be a straightforward task.

1.5 Course Objectives

Learn

1.6 The Life of Programmers

1.7 Assignment #1: APIs

Due: We, Apr 2, at class

Q&A