Lecture 1: Introduction to JAVA

Slides:



Advertisements
Similar presentations
EC-111 Algorithms & Computing Lecture #1 Instructor: Jahan Zeb Department of Computer Engineering (DCE) College of E&ME NUST.
Advertisements

ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
Copyright © 2002 W. A. Tucker1 Chapter 1 Lecture Notes Bill Tucker Austin Community College COSC 1315.
CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib.
Java: History and Introduction (Lecture # 1). History… Java – Based on C and C++ – Developed in 1991 for intelligent consumer electronic devices – Green.
Chapter 1: An Overview of Computers and Programming Languages J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program.
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Introduction to Computer Programming CSC 1401: Introduction to Programming with Java Lecture 2 Wanda M. Kunkle.
ICS 102 Computer Programming University of Hail College of Computer Science & Engineering Computer Science and Software Engineering Department.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
Computers & Logic An Overview. Hardware Hardware is the equipment, or the devices, associated with a computer. For a computer to be useful, however, it.
 2003 Prentice Hall, Inc. All rights reserved. Chapter 1 – Introduction to Computers, the Internet, and the Web Outline 1.1 Introduction 1.2 What Is a.
Computer Programming-1 CSC 111 Chapter 1 : Introduction.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
CS 161 INTRO TO PROGRAMMING I Dr. Blaise W. Liffick Fall
Chapter Introduction to Computers and Programming 1.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Chapter 1 An Overview of Computers and Programming Languages.
1 Lecture 2 : Computer System and Programming. Computer? a programmable machine that  Receives input  Stores and manipulates data  Provides output.
An Introduction to Computers August 12, 2008 Mrs. C. Furman.
What is a Computer? An, electrical machine, that can be programmed to accept data (input), process it into useful information (output) and store it away.
C++ Programming Language Lecture 1 Introduction By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science Department Lecture 1 : Introduction.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
1 Lecture 2 : Computer System and Programming. Computer? a programmable machine that  Receives input  Stores and manipulates data  Provides output.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
CHAPTER 1 INTRODUCTION 1 st semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
CT1513 Introduction To java © A.AlOsaimi.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
A compiler is a computer program that translate written code (source code) into another computer language Associated with high level languages A well.
Chapter 1 Computers, Compilers, & Unix. Overview u Computer hardware u Unix u Computer Languages u Compilers.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Chapter 1 09/04/13. Change Your Password  The command is: passwd In the lab first do : ssh -Y onyx  You will have to see me to change it, if you forget.
A.Abhari CPS1251 Topic 1: Introduction to Computers Computer Hardware Computer components Connecting Computers Computer Software Operating System (OS)
Senem KUMOVA METİN // Fall CS 115 Introduction to Programming Introduction to Computing.
Brief Version of Starting Out with C++ Chapter 1 Introduction to Computers and Programming.
1 Introduction Read D&D Sec 1.8; Sec 1.13 THE Java tutorial -
Chapter 1 An Overview of Computers and Programming Languages.
Introduction to Computer Programming using Fortran 77.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages.
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
Introduction to Computer Programming By: Mr. Baha Hanene Chapter 1.
Chapter 1 Introduction 2nd Semester H
Software Development Environment
Java Programming: From the Ground Up
BASIC PROGRAMMING C SCP1103 (02)
Chapter 1 – Introduction to Computers, the Internet, and the Web
Key Ideas from day 1 slides
BASIC PROGRAMMING C SCP1103 (02)
Introduction
Introduction to Programming
Computer System and Programming
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Introduction to Computers and Java
Java programming lecture one
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design
Introduction CSC 111.
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
National Diploma in Computer Studies
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Understand the interaction between computer hardware and software
Chapter 1 – Introduction to Computers, the Internet, and the Web
Computer Programming-1 CSC 111
Chapter 1 Introduction to Programming
ICS103 Programming in C 1: Overview of Computers And Programming
Presentation transcript:

Lecture 1: Introduction to JAVA CS 212 : Programming 1 java Lecture 1: Introduction to JAVA

Outline What is a computer . What is a computer program What is programming language JAVA

What Is a computer? Element of computer: -Executes statements (computations/logical decisions) Element of computer: Hardware :Physical devices of computer system Software: Programs that run on computers Hardware Software Computer

Computer Organization Six logical units of computer system Input unit (Mouse, keyboard) Output unit (Printer, monitor, audio speakers) Memory unit (Retains input and processed information) Central processing unit (CPU) which consists of: Control unit (controls the other components & Guarantees instruction are executed in sequence ) Arithmetic and logic unit (ALU) (Performs arithmetic and logical operations) Secondary storage unit (Hard drives, floppy drives)

What is a computer program? For a computer to be able to perform specific tasks, it must be given instructions to do the task. A Computer Program is The set of instructions that tells the computer to perform specific tasks Each instruction tells the computer to do something ( an action, a calculation, a comparison ) Introduction to OOP Dr. S. GANNOUNI & Dr. A. TOUIR

Program Execution A program tells the CPU how to manipulate and/or move information Programming is about processing information Take some input, manipulate it in some way, and produce a particular output Program Manipulation Inputs Outputs ICS102: Intro To Comp

Programming languages A program is expressed in a computer language. Languages differ in Size ( complexity) Readability Writability Level : closeness to instructions for CPU

Machine Language

Assembly Language

High- level languages

Java It was first released in 1995. Java is a programming language originally developed by James Gosling at Sun Microsystems It was first released in 1995. The language derives much of its syntax from C and C++. But has a simpler object model and fewer low-level facilities than C and C++. ICS102: Intro To Comp

Why Coding in high –level Programming Languages We write computer programs (i.e. a set of instructions) in programming languages such as C, C++, and Java. We use these programming languages because they are easily understood by humans But then how does the computer understand the instructions that we write?

Compiling Computer Programs Computers do not understand programs written in programming languages such as C++ and Java Programs must first be converted into machine code that the computer can run A Software that translates a programming language statements into machine code is called a compiler Machine code Program Source code Machine Code Translating Compiling

Programming Language Compiler A compiler is a software that: Checks the correctness of the source code according to the language rules. Syntax errors are raised if some rules were violated. Translates the source code into a machine code if no errors were found.

Platform dependent Compiling Because different platforms, or hardware architectures along with the operating systems (Windows, Macs, Unix), require different machine code, you must compile most programs separately for each platform.

Compiling Java Programs The Java compiler produces bytecode (a “.class” file) not machine code from the source code (the “.java” file). Bytecode is converted into machine code using a Java Interpreter Source Code Bytecode

Platform Independent Java Programs Compiling You can run bytecode on an computer that has a Java Interpreter installed “Hello.java” “Hello.class”

Multipurpose Java Compiling

Running The Program The Java Virtual Machine Components The Class Loader stores bytecodes in memory Bytecode Verifier ensures bytecodes do not violate security requirements Bytecode Interpreter translates bytecodes into machine language Class Loader Running Bytecode Verifier Bytecode The Bytecode (the “.class” file) Interpreter JVM Operating System JVM is platform specific. The interpreter translates the bytecodes into specific machine commands. Hardware

Testing and Debugging the Program Be sure that the output of the program conforms with the input. There are two types of errors: Logical Errors: The program run but provides wrong output. Runtime errors: The program stop running suddenly when asking the OS executing a non accepted statement (divide by zero, etc). Debugging Find, Understand and correct the error

Phase 1 Editor Phase 2 Compiler Phase 3 Class Loader Bytecode Verifier Primary Memory . Disk Editor Compiler Class Loader Program is created in an editor and stored on disk in a file ending with .java. Compiler creates bytecodes and stores them on disk in a file ending with .class. Class loader reads .class files containing bytecodes from disk and puts those bytecodes in memory. Phase 1 Phase 2 Phase 3 Bytecode Verifier Bytecode verifier confirms that all bytecodes are valid and do not violate Java’s security restrictions. Phase 4 Interpreter Interpreter reads bytecodes and translates them into a language that the computer can understand, possibly storing data values as the program executes. Phase 5

Some Characteristics of Java Object-Oriented Combines data and behavior into one unit objects Provides Data abstraction and encapsulation Decompose program into objects. Programs are collections of interacting and cooperating objects. Platform-independent Portable Architecture neutral ”Write-once, run-anywhere” Secure The bytecode verifier of the JVM : checks untrusted bytecode controls the permissions for high level actions.

Classical model : Java model :