computer science i 22c 016 106
Download
Skip this Video
Download Presentation
Computer Science I 22C: 016/106

Loading in 2 Seconds...

play fullscreen
1 / 25

Computer Science I 22C: 016/106 - PowerPoint PPT Presentation


  • 270 Views
  • Uploaded on

Computer Science I 22C: 016/106. Jun Ni. Ph.D. Adjunct Assistant Professor Department of Computer Science The University of Iowa Iowa City, IA 52242. Introduction. Computer science Computer programming languages Prerequisites: access computer

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Computer Science I 22C: 016/106' - menora


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
computer science i 22c 016 106

Computer Science I22C: 016/106

Jun Ni. Ph.D.

Adjunct Assistant Professor

Department of Computer Science

The University of Iowa

Iowa City, IA 52242

introduction
Introduction
  • Computer science
  • Computer programming languages
  • Prerequisites:
    • access computer
    • installation of JDK 1.1 or later version (Java 2, SDK, from www.javasoft.com)
    • Editing Java codes using editing tools
    • textbook
    • Your commitment in learning programming
introduction1
Introduction
  • Computer basics (hardware and software)
    • Hardware: physical computer machine
      • CPU, or processor, chip
      • memory (primary, main, temporary)
      • disk memory (secondary, auxiliary, permanent)
      • Unit of memory: Byte (8 bits)
      • Address of memory, address of data is the first byte
      • input devices: keyboard, mouse, …
      • output devices: screen, monitor, printer, ...
introduction2
Introduction

Binary Memory address (location)

01001010 2823454

01100001 2823455

01110110 2823456

01100001 2823457

00110001 2823458

00101110 2823459

00110010 2823410 (in unit of byte)

introduction3
Introduction

Binary ASCII

01001010 J

01100001 a

01110110 v

01100001 a

00110001 1

00101110 .

00110010 2

introduction4
Introduction
  • Computer basics (hardware and software)
    • Software: programs give instructions to computer for computing
    • running or executing: processing to perform computing
    • input data and output result
    • Operating System: supervisory program

OS and programs

Input data

Output result

computer

introduction5
Introduction
  • High-Level Programming Languages
  • Lower-level programming Languages

FORTRAN, C/C++, BASIC

COBOL, Lisp, Ada

(source codes)

compilers

Machine languages or assembly languages

(object codes)

introduction6
Introduction
  • Java Byte code:
    • Java compiler translates Java programming language into byte code, which can be interpreted to computer’s machine language.
    • The interpreter is called Java Virtual Machine (JVM) which translates from byte-code instructions to machine language instructions.

Compiler

Java code

Byte code

Byte code

Machine language

(JVM)

introduction7
Introduction

Java program

Input data

Java compiler

Byte code

interpreter (JVM)

Machine-language instructions

Execution of

machine-language instructions

output

introduction8
Introduction
  • Designing Programming (programming techniques)
    • methods used to solve problems (algorithm)
    • algorithm in computer science means a set of instructions for solving a problem
    • algorithm into pseudo-code, then then into programming language
introduction9
Introduction
  • Designing Programming (programming techniques)
    • Procedure programming (PP)
      • data (not cataloged) and computing procedure
    • Object-orient programming (OOP)
      • class: same kind of objects cataloged together
      • object: data (cataloged) behaviors (action or methods)
      • computing procedure
    • scalability of classes
    • testing and debugging
introduction10
Introduction
  • Errors
    • syntax error: mistakes caused due to the conflict of grammar rule of programming language
    • run-time error: errors occurs when program is running, system errors
    • logic error: errors happens due to the mistakes of logical design of the program
introduction11
Introduction
  • Java history
  • Java applications and Java applets
  • Java simple example

public class FirstProgram

{

public static void main(String[] args)

{

System.out.println("Hello out there.");

System.out.println("Want to talk some more?");

System.out.println("Answer y for yes or n for no.");

slide14

char answerLetter;

answerLetter = SavitchIn.readLineNonwhiteChar();

if (answerLetter == \'y\')

System.out.println("Nice weather we are having.");

System.out.println("Good-bye.");

System.out.println("Press enter key to end program.");

String junk;

junk = SavitchIn.readLine();

}

}

introduction12
Introduction
  • OOP’s method invocation
  • syntax:
  • example:

Object_Name.Method_Name(arguments)

System.out.println("Press enter key to end program.");

junk = SavitchIn.readLine( );

introduction13
Introduction
  • Naming in Java
    • identifier, names in program
    • case-sensitive
    • rules of identifier
    • convention
introduction14
Introduction
  • Reserved keywords:

abstract break bytes case

catch char class const

continue default do double

else extends final finally

float for future generic

goto if implements

import innner instanceof

long native new null

operator package private protected

introduction15
Introduction
  • Reserved keywords (continued):

public rest return short

static supper switch synchronized

this throw throws transient

try var void volatile

while

introduction16
Introduction
  • How to install JDK on a PC
    • download from www.javasoft.com
    • setting path and class path in PC\'s autoexec.bat

REM setting for JDK 1.2

REM set PATH=c:\jdk1.2beta4\bin; %PATH%;

REM set CLASSPATH=.;c:\jdk1.2beta4\lib; ;%CLASSPATH%;

REM setting for JDK 1.3 (SDK)

set PATH=c:\jdk1.3\bin;%PATH%;

set CLASSPATH=.;c:\jdk1.3\lib;%CLASSPATH%;

introduction17
Introduction
  • How to install JDK on a Mac
    • download MRJ from www.apple.com
  • How to install install JDK on a UNIX (LINUX) platform (ask your system administrator)
introduction18
Introduction
  • How to compile a Java code on a PC or on UNIX (LINUX)
  • How to compile a Java code on a Mac
    • open "javac" program in MRJ, or drag your Java code to "javac" program

javac JavaCode.java

introduction19
Introduction
  • How to execute a Java Byte code on PC or on a UNIX (LINUX) platform

java JavaCode.java

For Java application

java JavaCode

For Java applet

appletviewer HTMLfile (which calls JavaCode)

introduction20
Introduction
  • How to execute JavaByte code on a Mac
    • open "Jbinary" program in MRJ, or drag your Java code to Jbinary program for Java applications
    • open "Apple Applet Runner" program in MRJ, or drag your Java code to "Apple Applet Runner" program for Java applets
introduction21
Introduction
  • Java commercial development tools (alternative and optional)
      • Microsoft\'s J++
      • Bordland\'s JBuilder
      • Symantec\'s Café
      • IBM\'s Visual Age
      • Sun\'s Java Workshop
      • CodeWarrier
introduction22
Introduction
  • Homework Assignment:
    • Read chapter 1 of Walter Savitch\'s textbook
    • do self-test questions through 1 to 19
    • Do Exercises 1 to 3, on Page 27 to 28
    • Due date: Feb. 6, 2001
ad