The Joy of Programming (also known as) Introduction to Object-Oriented Programming.

Slides:



Advertisements
Similar presentations
What is a Computer Program? For a computer to be able to do anything (multiply, play a song, run a word processor), it must be given the instructions.
Advertisements

Designing a Program & the Java Programming Language
Introduction To Java Objectives For Today â Introduction To Java â The Java Platform & The (JVM) Java Virtual Machine â Core Java (API) Application Programming.
Introduction to Java The objectives of this chapter are: To describe the key aspects of Java To describe the Java software development kit (SDK) To explain.
Object Orientated Programming
Introduction to Java Kiyeol Ryu Java Programming Language.
1 Fall 2008ACS-1903 Chapter 1 Topics Java History Java Programs Why Program? Computer Systems: Hardware and Software Programming Languages What Is a Program.
Introduction to the JDK Java for Computational Finance
PHY281Introduction to JavaSlide 1 Introduction to Java In this section we will learn how how to use Java and write our first Java Applet:  The Java Development.
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
COP 2800 Lake Sumter State College Mark Wilson, Instructor.
01 Introduction to Java Technology. 2 Contents History of Java What is Java? Java Platforms Java Virtual Machine (JVM) Java Development Kit (JDK) Benefits.
Getting Started with Java
Advanced OOP MCS-3 OOP BSCS-3 Lecture # 1
Introduction to Java Programming. Contents 1. Java, etc. 2. Java's Advantages 3. Java's Disadvantages 4. Types of Java Code 5. Java Bytecodes 6. Steps.
Introduction to Java Tonga Institute of Higher Education.
Java Programming, 2E Introductory Concepts and Techniques Chapter 2 Creating a Java Application and Applet.
Introduction to Java Programming CS 21a: Introduction to Computing I Department of Information Systems and Computer Science Ateneo de Manila University.
Introduction to Java Programming with JBuilder 4
Introduction to Java Programming CS 21a: Introduction to Computing I First Semester,
CS413: Java Programming language Applications Applets
(C) 2010 Pearson Education, Inc. All rights reserved.  Java programs normally go through five phases  edit  compile  load  verify  execute.
CMSC 202 Computer Science II for Majors Object-Oriented Programming.
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Programming Languages Machine.
Java Lecture 16: Dolores Zage. WWW n Was a method for distributing passive information n added forms and image maps n interaction was only a new way to.
Rina System development with Java Instructors: Rina Zviel-Girshin Interdiciplinary Center Herzlia School of the Computer Science Fall:
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.
Java Applets. 2 Introduction to Java Applet Programs  Applications are stand alone programs executed with Java interpreter executed with Java interpreter.
Jaeki Song ISQS6337 JAVA Lecture 03 Introduction to Java -The First Java Application-
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
POS 406 Java Technology And Beginning Java Code
Java Programming, Second Edition Chapter One Creating Your First Java Program.
1 Programming Fundamentals AITI-GP. 2 Introduction to Programming.
CS 3131 Introduction to Programming in Java Rich Maclin Computer Science Department.
Software for Translators Barcelona, January 2002.
Introduction to Java Programming. Introduction Course Objectives Organization of the Book.
Java Applets. 2 Introduction to Java Applet Programs Applications are ___________________ programs –executed with Java interpreter Applet is a small program.
Session 1 Introduction to Java. Objectives Java Simplified / Session 1 / 2 of 32 Explain the history of Java Explain Java in brief List the types of Java.
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
4-Nov-15 Air Force Institute of Technology Electrical and Computer Engineering Object-Oriented Programming Design Topic 1: The Java Environment Maj Joel.
Lecture.1: Getting Started With Java Jiang (Jen) ZHENG May 9 th, 2005.
CSE S. Tanimoto Java Introduction 1 Java A Programming Language for Web-based Computing with Graphics.
CSE S. Tanimoto Java Introduction 1 Java A Programming Language for Web-based Computing with Graphics.
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.
Intro to Applets. Applet Applets run within the Web browser environment Applets bring dynamic interaction and live animation to an otherwise static HTML.
Your name CSCI/CMPE 3326 Object-Oriented Programming in Java Dongchul Kim Department of Computer Science University of Texas – Pan American 1.Applet.
Introduction to Programming. The Programming Process Create/Edit Program Compile Program Execute Program Compile Errors?Run-Time Errors? Source Program.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
Creating a Java Application and Applet
©2016 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved. CSC 110 – INTRO TO COMPUTING - PROGRAMMING Overview of Programming.
1 Introduction Read D&D Sec 1.8; Sec 1.13 THE Java tutorial -
ITP 109 Week 2 Trina Gregory Introduction to Java.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 15: Java Basics Fundamentals of Web Programming.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to Computers,
Introduction to 1. What is Java ? Sun Microsystems Java is a programming language and computing platform first released by Sun Microsystems in The.
Introduction to Java Programming, 4E Y. Daniel Liang.
CSE S. Tanimoto Java Introduction 1 Java A Programming Language for Web-based Computing.
Introduction to Algorithm. What is Algorithm? an algorithm is any well-defined computational procedure that takes some value, or set of values, as input.
Applications Active Web Documents Active Web Documents.
GC101 Introduction to computer and program
Chapter 1 Introduction to Computers, Programs, and Java
Chapter Two Applet vs. Application
Introduction to Java Dept. Business Computing University of Winnipeg
Chapter 1 Introduction to Computers, Programs, and Java
Java Applets.
Chap 1. Getting Started Objectives
Computer Programming-1 CSC 111
G6DICP - Lecture 27 Java Applets.
Outcome of the Lecture Upon completion of this lecture you will be able to understand Fundamentals and Characteristics of Java Language Basic Terminology.
Presentation transcript:

The Joy of Programming (also known as) Introduction to Object-Oriented Programming

Resources Java in a Nutshell from O’Reilly Java Standard Edition (JSE) download tml (download the SDK, not the JRE; you may not want it bundled with NetBeans; you can also download the documentation from this link) Java API Documentation Java Tutorial Lots of other stuff

What is a computer? memoryprocessordisk I/O devices data instructions

Programming Languages assembled languages // X = (A+B) * (C+D) LR 1, A // load register 1 from A AR 1, B // add B to register 1 LR 2, C // load register 2 from C AR 2, D // add D to register 2 MP 2, #1 // multiply register 2 by register 1 SR 2, X // store register 2 in X compiled languages (Fortran, Cobol) X = (A + B) * (C + D) structured languages (C, Pascal)

Programming Languages (cont.) object-oriented languages (C++, Ada, Smalltalk, Java) 4th generation languages: special purpose (RPG, DBASE, Delphi) –databases –proprietary products visual programming environments /integrated development environments (Visual Basic, Visual C++, JBuilder, Eclipse)

Compiled vs. Interpreted Compiled Languages source code => compiler => relocatable object code => loader => absolute code –source code is portable (sort of) –object code is platform-specific Interpreted Languages (Java) source code=> compiler => bytecode => interpreter => absolute code on the fly –bytecode is portable to any platform with an interpreter –interpreting is slower

Java an object oriented language an interpreted language developed by Sun MicroSystems versions: –JDK v1.7.x available free from Oracle:

Applications vs. Applets A program which runs directly on the computer is called an application programs may also be downloaded from the web and run in a browser; these are called applets applets are an outgrowth of Java’s platform independence, which allows an applet to run in a browser on any machine (PC, MAC, UNIX, …) applets are subject to security restrictions: –they cannot read or write the local hard drive –they cannot print –they can only talk to the computer that served them

Java Structure The basic programming element in Java is the class every class has a name all instructions and data in Java exist in a class classes usually contain methods, which also have a name all instructions in Java exist in a method inside a class (almost)

Application Mechanics write a class in a text editor; save it to a file with the same name as the class and a.java suffix set the path: –In the MS-DOS Prompt window set path=%path%;c:\jdk1.4\bin –Windows98, etc.:in C:Autoexec.bat (save the original first) –WindowsXP: Control Panel > System > Advanced > Environment Variables > select Path under System Variables > Edit compile the file in an MS-DOS Prompt window: javac MyProgram.java run the class in an MS-DOS Prompt window: java MyProgram

Applet Mechanics write a class that extends Applet in a text editor; save it to a file with the same name as the class and a.java suffix compile in an MS-DOS Prompt window: javac MyApplet.java write an html program to load the applet; save it to a file with.html suffix load the html file in a browser, or via appletviewer in an MS-DOS Prompt window: appletviewer MyApplet.html applets usually involve a graphical display, and/or some interaction with the user (GUI)

Hello World Application // the HelloWorld class, in file HelloWorld.java public class HelloWorld { // the main method public static void main (String[] args) { System.out.println (“Hello World!”); } –class –method definition –method invocation –method parameters/Strings –comments –keywords (in blue) –curly braces/indentation

Hello World Applet import java.applet.*; import java.awt.*; // the HelloWorldApplet class // (saved as HelloWorldApplet.java) public class HelloWorldApplet extends Applet { // the paint method public void paint (Graphics g) { g.drawString (“Hello World!”, 20, 20); }

Hello World Applet (cont.) the HTML, saved as HelloWorldApplet.html First Applet <APPLET code=HelloWorldApplet.class width=200 height=100>

Edit program Compile program Compiler errors? Run program Exceptions? Incorrect Results? yes Program Development Process

Algorithms A procedure which is –unambiguous –executable –terminating Example: IRS Form 1040 computer programs implement algorithms you must understand the algorithm before it can be programmed