30
Overview of Intro. to Java Programming Hui Chen Department of Computer & Information Science Brooklyn College 8/26/2021 CUNY | Brooklyn College 1

Overview of Intro. to Java Programming

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Overview of Intro. to Java Programming

Overview of Intro. to

Java ProgrammingHui Chen

Department of Computer & Information Science

Brooklyn College

8/26/2021 CUNY | Brooklyn College 1

Page 2: Overview of Intro. to Java Programming

Objectives

• To understand computer basics, programs, and operating systems

• To understand the meaning of Java language specification, API, JDK, and IDE

• To write a simple Java program

• To display output on the console

• To explain the basic syntax of a Java program

• To create, compile, and run Java programs

8/26/2021 CUNY | Brooklyn College 2

Page 3: Overview of Intro. to Java Programming

Outline

• What is a computer?

• What is a program?

• What is a programing language?

• How do we let a computer run a program?

• What is an operating system?

• Why Java?

• How do we write a simple Java program?

8/26/2021 CUNY | Brooklyn College 3

Page 4: Overview of Intro. to Java Programming

What is a computer?

8/26/2021 CUNY | Brooklyn College 4

Page 5: Overview of Intro. to Java Programming

Components of Computers

• CPU

• Memory and Storage

• Input and Output Devices

• Communication Devices

8/26/2021 CUNY | Brooklyn College 5

Page 6: Overview of Intro. to Java Programming

CPU

• Instruction set

• Clock speed

• Cache

• Multi-core CPUs

8/26/2021 CUNY | Brooklyn College 6

Page 7: Overview of Intro. to Java Programming

Memory Hierarchy

• Roles

• Main memory

• Secondary storage

• Tertiary storage (backup)

• Characteristics

• Volatile vs non-volatile

• Access latency (speed)

• Capacity (size)

• Reliability (e.g., MTBF)

8/26/2021 CUNY | Brooklyn College 7

Page 8: Overview of Intro. to Java Programming

How Data is Stored?

• Representation

• Binary representation

• Bits and Bytes

• Units of measurement

• Addressing

8/26/2021 CUNY | Brooklyn College 8

Page 9: Overview of Intro. to Java Programming

Input and Output Devices

• Input devices

• Mouse, keyboard, touch pad, joy sticker, …

• Output devices

• Monitor

• Resolution

• Dot pitch

• Printer

8/26/2021 CUNY | Brooklyn College 9

Page 10: Overview of Intro. to Java Programming

Communication Devices

• Examples

• Bluetooth

• Ethernet

• Wireless LAN (e.g., Wi-Fi)

8/26/2021 CUNY | Brooklyn College 10

Page 11: Overview of Intro. to Java Programming

Questions?

8/26/2021 CUNY | Brooklyn College 11

Page 12: Overview of Intro. to Java Programming

What is a program?

• (computer) hardware vs. (computer) software

• Programs are software

• Instructions to a computer, written in a

programming language

8/26/2021 CUNY | Brooklyn College 12

Page 13: Overview of Intro. to Java Programming

Questions?

8/26/2021 CUNY | Brooklyn College 13

Page 14: Overview of Intro. to Java Programming

What is a programming language?

• Machine language

• Assembly language

• High-level language

8/26/2021 CUNY | Brooklyn College 14

Page 15: Overview of Intro. to Java Programming

Examples of High-Level Languages

8/26/2021 CUNY | Brooklyn College 15

Page 16: Overview of Intro. to Java Programming

Questions?

8/26/2021 CUNY | Brooklyn College 16

Page 17: Overview of Intro. to Java Programming

How do we let a computer run a

program?

• How do we let a computer run a program written in

a high-level (or assembly) language?

• Source code, interpreter, and compiler

• Interpreting

• Compilation

8/26/2021 CUNY | Brooklyn College 17

Page 18: Overview of Intro. to Java Programming

Questions?

8/26/2021 CUNY | Brooklyn College 18

Page 19: Overview of Intro. to Java Programming

What is an operating system?

• Examples of operating systems?

• What does an operating system do?

8/26/2021 CUNY | Brooklyn College 19

Page 20: Overview of Intro. to Java Programming

Questions?

8/26/2021 CUNY | Brooklyn College 20

Page 21: Overview of Intro. to Java Programming

Why Java?

• Java is a general purpose high-level programming

language? But why?

• JRE vs JDK

8/26/2021 CUNY | Brooklyn College 21

Page 22: Overview of Intro. to Java Programming

Questions?

8/26/2021 CUNY | Brooklyn College 22

Page 23: Overview of Intro. to Java Programming

Writing a simple Java program?

• Preferred development environment

• Git bash + Atom editor + JDK 1.8 or newer

• (Optional) Using IDEs

• IntelliJ IDEA

• Eclipse

• NetBeans

• …

8/26/2021 CUNY | Brooklyn College 23

Page 24: Overview of Intro. to Java Programming

Let’s write a simple Java program

• Class name

• Main method

• Statements

• Statement terminator

• Reserved words

• Comments

• Blocks

8/26/2021 CUNY | Brooklyn College 24

Page 25: Overview of Intro. to Java Programming

What if there is an error?

• What kind of error?

• How do we deal with errors?

8/26/2021 CUNY | Brooklyn College 25

Page 26: Overview of Intro. to Java Programming

Questions?

8/26/2021 CUNY | Brooklyn College 26

Page 27: Overview of Intro. to Java Programming

Assignments

• Journal Exercise 1

• Journal Exercise 2

• CodeLab Assignment 0

8/26/2021 CUNY | Brooklyn College 27

Page 28: Overview of Intro. to Java Programming

(Journal) Exercise 1

• Preparing programming environment

• Download and set up Git, Atom, JDK

• Optionally, using an IDE

• Create a journal directory (e.g., journal), and create

a subdirectory (e.g., C0826)

• Document the experience (concisely) in a text file

8/26/2021 CUNY | Brooklyn College 28

Page 29: Overview of Intro. to Java Programming

(Journal) Exercise 2

• Write, compile, and run the “Hello, World” java

program

1. Create/Revise the program

2. Compile the program

3. Run the program

4. Introduce errors on purpose (e.g., remove “;”, remove

“(“, remove “}”, change “main” to “primary”), repeat 1

- 3

8/26/2021 CUNY | Brooklyn College 29

Page 30: Overview of Intro. to Java Programming

(CodeLab) Exercise 0

• Complete CodeLab registration

8/26/2021 CUNY | Brooklyn College 30