1 Chapter 1 Java –Originally for intelligent consumer-electronic devices –Then used for creating Web pages with dynamic content –Now also used for: Develop.

Slides:



Advertisements
Similar presentations
 2005 Pearson Education, Inc. All rights reserved Introduction.
Advertisements

1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
 2002 Prentice Hall. All rights reserved. Chapter 1 – Introduction to Computers, the Internet, and the Web Java, How to Program, 4 th Edition, by Deitel.
Visual and Internet Programming using JAVA
 2003 Prentice Hall, Inc. All rights reserved. 1 Introduction to C++ Programming Outline History of C and C++ C++ Standard Library Object Technology Basics.
Chapter 2 - Introduction to Java Applications
Object Orientated Programming
Java: History and Introduction (Lecture # 1). History… Java – Based on C and C++ – Developed in 1991 for intelligent consumer electronic devices – Green.
 2008 Pearson Education, Inc. All rights reserved Introduction to C++ Programming.
CMT Programming Software Applications
Java Environment (CSS444)
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 1 – Introduction to Computers, the Internet, and the Web Outline 1.1 Introduction 1.2 What Is.
Introduction to Computer Programming CSC 1401: Introduction to Programming with Java Lecture 2 Wanda M. Kunkle.
 2003 Prentice Hall, Inc. All rights reserved. 1 Machine Languages, Assembly Languages, and High-level Languages Three types of computer languages 1.Machine.
 2002 Prentice Hall. All rights reserved. Week 1 - Introduction to Object- Oriented Programming Outline 1.1 Machine Languages, Assembly Languages and.
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to Python Programming Outline 2.1 Introduction 2.2 First Program in Python: Printing.
Java PAL.  Contains the development kit and the runtime environment ( aka the Java Virtual Machine )  Download Link:
 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.
COMPUTER SCIENCE I C++ INTRODUCTION
1 Chapter 1 - Introduction to Computers, the Internet, and the World Wide Web Outline 1.1Introduction 1.2What Is a Computer? 1.3Computer Organization 1.4Evolution.
1 1 1 Introduction to Java. 2 History of Java Java – Originally for intelligent consumer-electronic devices – Then used for creating Web pages with dynamic.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
 2005 Pearson Education, Inc. All rights reserved. 1 Introduction & The Java Virtual Machine Small Java Chapter 1 1.
 2003 Prentice Hall, Inc. All rights reserved. 1 Java Training Course Dr. H.E. Dunsmore Purdue University Java – How to Program, Deitel (5 th Edition)
 2005 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and the World Wide Web.
History of C and C++ C++ evolved from C ANSI C C++ “spruces up” C
Programming in Java This is a one semester course. You will learn the language and some basic programming skills. You are expected to read, program,
Introduction To System Analysis and Design
 2002 Prentice Hall. All rights reserved. Chapter 1 – Introduction to Computers, the Internet, and the Web Outline 1.1 Introduction 1.2 What Is a Computer?
1.8History of Java Java –Based on C and C++ –Originally developed in early 1991 for intelligent consumer electronic devices Market did not develop, project.
1 Chapter 1 Introduction to Java. 2 History of Java Java Originally for _________________________ devices Then used for creating Web pages with __________________________.
1 Chapter 1 Java –Originally for intelligent consumer-electronic devices –Then used for creating Web pages with dynamic content –Now also used for: Develop.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 2 Chapter 2 - Introduction to C Programming.
 Pearson Education, Inc. All rights reserved Introduction to Java Applications.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
1 MIS 131 Introduction to Algorithms and Programming 2015/2016 Fall - Chapter 1 -
1 COMP 241: Object-Oriented Programming with Java Fall 2004 Lecture 1 September 27, 2004 Serdar Taşıran.
CT1513 Introduction To java © A.AlOsaimi.
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.
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Spring 2013 Lecture 1: Introduction.
 2003 Prentice Hall, Inc. All rights reserved. Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 2 - Introduction to C Programming Outline.
1 Introduction Read D&D Sec 1.8; Sec 1.13 THE Java tutorial -
 2003 Prentice Hall, Inc. All rights reserved Basics of a Typical C++ Environment C++ systems –Program-development environment –Language –C++
1 1 1 Introduction to Java. 2 History of Java Java – Originally for intelligent consumer-electronic devices – Then used for creating Web pages with dynamic.
Chapter 1 – Introduction to Computers, the Internet, and the Web Outline 1.1 Introduction 1.2 What Is a Computer? 1.3 Computer Organization 1.4 Evolution.
Introduction to Computers, the Internet and the World Wide Web
Chapter 1: Introduction to computers and C++ Programming
Chapter 1 – Introduction to Computers, the Internet, and the Web
Lecture 1: Introduction to JAVA
Chapter 2 - Introduction to C Programming
2.5 Another Java Application: Adding Integers
Chapter 2 - Introduction to C Programming
Chapter 7 - JavaScript: Introduction to Scripting
Chapter 1 – Introduction to Computers, the Internet, and the Web
JavaScript: Introduction to Scripting
1.13 The Key Software Trend: Object Technology
Chapter 2 - Introduction to Java Applications
Chapter 1 – Introduction to Computers, the Internet, and the Web
Programs written in C and C++ can run on many different computers
Capitolo 1 – Introduction C++ Programming
Chapter 7 - JavaScript: Introduction to Scripting
Chapter 7 - JavaScript: Introduction to Scripting
Chapter 1 – Introduction to Computers, the Internet, and the Web
Computer Programming-1 CSC 111
Introduction to C Programming
Chapter 7 - JavaScript: Introduction to Scripting
Presentation transcript:

1 Chapter 1 Java –Originally for intelligent consumer-electronic devices –Then used for creating Web pages with dynamic content –Now also used for: Develop large-scale enterprise applications Enhance WWW server functionality Provide applications for consumer devices (cell phones, etc.)

2 Thinking About Objects Objects –Reusable software components that model real-world items –Look all around you People, animals, plants, cars, etc. –Attributes Size, shape, color, weight, etc. –Behaviors Babies cry, crawl, sleep, etc.

3 Java Class Libraries Classes –Include methods that perform tasks Return information after task completion –Used to build Java programs Java contains class libraries –Known as Java APIs (Application Programming Interfaces)

4 Basics of a Typical Java Environment Java programs normally undergo five phases –Edit Programmer writes program (and stores program on disk) –Compile Compiler creates bytecodes from program –Load Class loader stores bytecodes in memory –Verify Verifier ensures bytecodes do not violate security requirements –Execute Interpreter translates bytecodes into machine language

5 Typical Java environment. 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 Primary Memory Bytecode Verifier Bytecode verifier confirms that all bytecodes are valid and do not violate Java’s security restrictions. Phase 4 Primary Memory 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

6 Thinking About Objects Object-oriented design (OOD) –Models real-world objects –Models communication among objects –Encapsulates attributes and operations (behaviors) Information hiding Communication through well-defined interfaces Object-oriented language –Programming in object oriented languages is called object-oriented programming (OOP) –Java

7 Thinking About Objects Object-Oriented Analysis and Design (OOA/D) –Essential for large programs –Analyze program requirements, then develop solution –UML Unified Modeling Language

8 Chapter 2 Programs A First Program in Java: Printing a Line of Text Modifying Our First Java Program Displaying Text in a Dialog Box Another Java Application: Adding Integers Memory Concepts Arithmetic Decision Making: Equality and Relational Operators

9 Discuss four small Java programs Welcome1.java Welcome2.java Welcome3.java Welcome4.java

10 Escape characters –Backslash ( \ ) –Indicates special characters be output

11 Another Java Application: Adding Integers Addition.java

12 Memory Concepts Visual Representation –Sum = 0; number1 = 1; number2 = 2; –Sum = number1 + number2; after execution of statement sum0 3

13 Arithmetic Arithmetic calculations used in most rograms –Usage * for multiplication / for division +, - No operator for exponentiation (more in Chapter 5) –Integer division truncates remainder 7 / 5 evaluates to 1 –Remainder operator % returns the remainder 7 % 5 evaluates to 2

14 Arithmetic Operator precedence –Some arithmetic operators act before others (i.e., multiplication before addition) Use parenthesis when needed –Example: Find the average of three variables a, b and c Do not use: a + b + c / 3 Use: ( a + b + c ) / 3 –Follows PEMDAS Parentheses, Exponents, Multiplication, Division, Addition, Subtraction

15 Arithmetic

16 Decision Making: Equality and Relational Operators

17 Precedence of operators