Computer Science 111:

Introduction to Computer Science I

Gregory M. Kapfhammer


flickr photo by GregKapfhammer shared under a Creative Commons (BY-NC-ND) license

Color Scheme

Key Concept

Corresponding Diagram

In-Class Discussion

In-Class Activity

Details in the Textbook

Computer Hardware

Central processing unit (CPU)

Input/output devices (I/O)

Main memory (MM)

Secondary memory devices (SMD)

Categories of Software

Operating systems

Applications and apps

Graphical user interface

Command-line interface

Binary Numbers

We love to use decimal ...

... but computers really don't! Why?

Bits and bytes

Unique numbers in 2-bit binary?

What about 3-bit binary?


creative commons licensed ( BY-SA ) flickr photo shared by mcclanahoochie

Bits and Bytes

Main memory is a grid of addresses

1 byte = 8 bits

1 word = 32 bits = 4 bytes

Kilobytes, megabytes, and gigabytes!

Volatile versus non-volatile

The memory hierarchy

Fast/slow, big/small, costly/cheap, close/far


creative commons licensed ( BY-SA ) flickr photo shared by mcclanahoochie

Analog and Digital

Similarities and differences?

Concrete examples?

Please see the textbook for additional discussion

Assembly Lines

CPU components and main memory (Fig. 1.13)

Fetch-decode-execute cycle

Complexity and computation

High-level versus low-level

What level will we program at?


creative commons licensed ( BY ) flickr photo shared by ninahale

Computer Networks

Network address

Try this command: ifconfig -a

Local-area and wide-area networks

Uniform resource locators

Network file system

Try this command: mount

Java Programs


public class Lincoln
{
   // prints a presidential quotation
   public static void main (String[] args)
   {
      System.out.println ("A quote by Abraham Lincoln:");
      System.out.println ("Whatever you are, be a good one.");
   }
}
                    
          

Can you find? ... The definition of a class

Java Programs


public class Lincoln
{
   // prints a presidential quotation
   public static void main (String[] args)
   {
      System.out.println ("A quote by Abraham Lincoln:");
      System.out.println ("Whatever you are, be a good one.");
   }
}
                    
          

Can you find? ... Java keywords

Java Programs


public class Lincoln
{
   // prints a presidential quotation
   public static void main (String[] args)
   {
      System.out.println ("A quote by Abraham Lincoln:");
      System.out.println ("Whatever you are, be a good one.");
   }
}
                    
          

Can you find? ... A method invocation

Java Programs


public class Lincoln
{
   // prints a presidential quotation
   public static void main (String[] args)
   {
      System.out.println ("A quote by Abraham Lincoln:");
      System.out.println ("Whatever you are, be a good one.");
   }
}
                    
          

Can you find? ... A character string

Java Programs


public class Lincoln
{
   // prints a presidential quotation
   public static void main (String[] args)
   {
      System.out.println ("A quote by Abraham Lincoln:");
      System.out.println ("Whatever you are, be a good one.");
   }
}
                    
          

Can you find? ... A single line comment

Java Programs


public class Lincoln
{
   // prints a presidential quotation
   public static void main (String[] args)
   {
      System.out.println ("A quote by Abraham Lincoln:");
      System.out.println ("Whatever you are, be a good one.");
   }
}
                    
          

Can you find? ... A declared variable

Formatting Concerns


public class Lincoln2{public static void main(String[]args){
System.out.println("A quote by Abraham Lincoln:");
System.out.println("Whatever you are, be a good one.");}}
                    
          

What is wrong with this program?


                              public       class
     Lincoln3
   {
                 public
   static
        void
  main
        (
String
            []
    args                       )
  {
  System.out.println        (
"A quote by Abraham Lincoln:"          )
  ;        }
          }
          
          

What is wrong with this program?

Input and Output

Levels of programming languages

Editing and running a Java program (Figure 1.20)

Compiling and running a Java program (Figure 1.21)

Using a modal text editor like GVim

Syntax and semantics of programming languages


creative commons licensed ( BY-ND ) flickr photo shared by loop_oh

Object-Oriented

The object is a fundamental entity in Java

Objects represent real-world entities

Let's review the basic terms on page 46!

Object, attribute, method, class

We will discuss these terms throughout the semester