Java programming lecture one

Slides:



Advertisements
Similar presentations
Operating Systems Components of OS
Advertisements

Introducing JavaScript
CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib.
 2005 Pearson Education, Inc. All rights reserved Introduction.
Object Orientated Programming
COSC 120 Computer Programming
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
1 Fall 2008ACS-1903 Chapter 1 Topics Java History Java Programs Why Program? Computer Systems: Hardware and Software Programming Languages What Is a Program.
CHAPTER 1 INTRODUCTION GOALS  To understand the activity of programming  To learn about the architecture of computers  To learn about machine code and.
Aalborg Media Lab 21-Jun-15 Software Design Lecture 1 “ Introduction to Java and OOP”
1. 2 Chapter 1 Introduction to Computers, Programs, and Java.
CS102 Introduction to Computer Programming
 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.
CS 161 INTRO TO PROGRAMMING I Dr. Blaise W. Liffick Fall
Parts of a Computer Why Use Binary Numbers? Source Code - Assembly - Machine Code.
Chapter 1 Introduction to Computers, Programs, and Java
Object Oriented Systems Lecture 01 First Java Programming Jaeki Song.
Chapter 1.4 Programming languages Homework Due: Monday, August 11, 2014.
111 © 2002, Cisco Systems, Inc. All rights reserved.
CISC105 General Computer Science Class 1 – 6/5/2006.
1 Chapter 2 First Java Programs Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
 2005 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and the World Wide Web.
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.
Week 1 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
Chapter 1 Introduction. Goal to learn about computers and programming to compile and run your first Java program to recognize compile-time and run-time.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
Jaeki Song ISQS6337 JAVA Lecture 03 Introduction to Java -The First Java Application-
Introduction to Computer Systems and the Java Programming Language.
Chapter 1 Introduction to Computers, Programs, and Java 1.
Chapter 1: Introduction to Programs, and Java 1. Objectives To review programs (§ ). To understand the relationship between Java and the World Wide.
Intro and Review Welcome to Java. Introduction Java application programming Use tools from the JDK to compile and run programs. Videos at
Java Programming, Second Edition Chapter One Creating Your First Java Program.
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
Fall 2006Slides adapted from Java Concepts companion slides1 Introduction Advanced Programming ICOM 4015 Lecture 1 Reading: Java Concepts Chapter 1.
Object Oriented Programming Lecture 3. Introduction  In discussing Java, some items need to be clarified  The Java programming language  The Java virtual.
J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition Second Edition D.S. Malik D.S. Malik.
JAVA Programming “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
Chapter 1 Introduction. Chapter Goals To understand the activity of programming To learn about the architecture of computers To learn about machine code.
1 JavaScript in Context. Server-Side Programming.
Lecture1 Instructor: Amal Hussain ALshardy. Introduce students to the basics of writing software programs including variables, types, arrays, control.
ITP 109 Week 2 Trina Gregory Introduction to Java.
Introduction to Computer Programming using Fortran 77.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 1 Introduction.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to Computers,
Java Programming Fifth Edition Chapter 1 Creating Your First Java Classes.
Fundamental of Java Programming (630002) Unit – 1 Introduction to Java.
Introduction to Algorithm. What is Algorithm? an algorithm is any well-defined computational procedure that takes some value, or set of values, as input.
Lecture 1b- Introduction
Before You Begin Nahla Abuel-ola /WIT.
Introduction to Computers, the Internet and the World Wide Web
Chapter 1: Introduction to computers and C++ Programming
CSC201: Computer Programming
Chapter 1 – Introduction to Computers, the Internet, and the Web
Chapter 1 Introduction to Computers, Programs, and Java
GC101 Introduction to computer and program
CSCI-235 Micro-Computer Applications
Chapter 1 Introduction to Computers, Programs, and Java
Lecture 1: Introduction to JAVA
Chapter 1 Introduction to Computers, Programs, and Java
Chapter 1 Introduction to Computers, Programs, and Java
Introduction CSC 111.
Chapter-1 Computer is an advanced electronic device that takes raw data as an input from the user and processes it under the control of a set of instructions.
Computer Programming-1 CSC 111
Programming language translators
ICS103 Programming in C 1: Overview of Computers And Programming
Outcome of the Lecture Upon completion of this lecture you will be able to understand Fundamentals and Characteristics of Java Language Basic Terminology.
Introduction to Computers, Programs, and Java
Presentation transcript:

Java programming lecture one Abdiasis abdallah

Chapter one: introduction What is programming? Programming means to create(develop) software, which is also called a program Software contains the instructions that tell the computer what to do.

Intro Software is all around you personal computers Word processors to write documents Web browsers to explore the internet Email programs to send and receive messages Running airplanes, appliances, cell phones and so on Software is created with the help of programming languages

This course teaches you how to program using Java Before starting we review some basic concepts about computers Computer hardware such as CPU, memory and storage Operating systems

What is a computer An electronic device that stores and processes data A computer contains both hardware and software Hardware is the physical elements of the computer Central processing unit (CPU) Main memory Storage devices (such as disks and devices) Input devices (such as mouse and keyboard) Output devices (such as monitor and printer) Communication devices (such as network cards)

Programming languages Machine language Computer’s native language A set of built-in primitive instructions in binary code 100101011101 Assembly language uses short descriptive word, know as mnemonic Add 2,3,result means add 2 and 3 and get result Assembler translates assemble language to machine It is machine dependent High-level language Platform independent

Operating system Manages and controls computer’s activities Application programs such as web browser cannot run without OS. Users and applications access computer hardware via OS.

OS Major tasks of an operating system Controlling and monitoring system activities Allocating and assigning system resources Scheduling applications Controlling and monitoring system activities Recognizing input from the keyboard Sending output to the monitor Keeping track of files and folders on storage devices Controlling peripheral devices such as printers Allocating and assigning system resources Determine what computer resources a program needs (CPU time, memory space, etc) Allocate and assign them to run the program Scheduling operations Multiprogramming allows multiple programs to run simultaneously by sharing the same CPU. For example editing text in word process at the same time web browser is downloading a file. Multithreading allows a single program to execute multiple tasks at the same time. For example editing and saving in word processor. Multiprocessing (parallel processing) uses two or more processors together to perform subtasks concurrently and then combine solutions

Java and WWW Java is powerful programming language for developing software running on mobile devices, desktop computer and servers. It was developed by sun micro-systems Designed in 1991 WWW is an electronic repository that can be accessed on the internet from anywhere in the world.

Java language specifications Java syntax is defined in the java language specification Java library is defined in java API JDK is the software for developing and running java programs API (application program interface) JDK (java development kit)

A simple java program A java program is executed from main method in the class.

Program explanation Line 1 : defines class Each java program must have at least one class Each class has a name By convention, class names start with uppercase letter Java source codes are case sensitive. Replacing main with Main results in error

explanation Line 2 : defines the main method The program is executed from main method A method is a construct that contains statements The main method in this program contains one statement (line 4) that displays the string “Welcome to java” on the console Every statement in java end with a semicolon, known as a statement terminator.

Reserved words Class, public, static, are examples of reserved words or keywords Keywords have specific meaning to the compiler, and cannot be used for other purposes in the program.

Comments Line 3 : comment Program documentation Ignored by the compiler Preceded by // on single line comment Enclosed between /* */ for block comment

Special characters

Creating, compiling and executing java programs You save java program in .java file and compile it into .class file The .class file is executed by java virtual environment You can use any text editor or IDE to create and edit java source code An example of IDE is eclipse An example of editor is windows notepad A java compiler translates java source file into java bytecode file

Java program development process Java language is a high level language, but java bytecode is a low level language. The bytecode is similar to machine instructions but architecture neutral and can run on any platform that has java virtual machine(JVM) JVM is a program that interprets java bytecode

JVM

Tips If you execute a class file that does not exist a NoClassDefFoundError will occur If you execute a class file that does not have a main method or you mistyped the main, a NoSuchMethodError will occur When executing a java program, the JVM first loads the bytecode of the class to memory using a program called the class loader. After a class is loaded, the JVM uses a program called the bytecode verifier to check the validity of the bytecode.

Programming errors Syntax errors Runtime errors Logic errors Also called compile errors Detected by the compiler Results from mistyped a keyword, omitting punctuation or not closing a brace Runtime errors Cause program to terminate abnormally Input mistakes e.g division by zero Logic errors

Common errors Missing closing brace Missing semicolon Missing quotation marks for strings Misspelling names