Getting Started What is Java? A programming language –Fully buzzword-compliant: A simple, object oriented, distributed, interpreted, robust, secure,

Slides:



Advertisements
Similar presentations
In Review JAVA C++ GUIs - Windows Webopedia.com.
Advertisements

Introduction To Java Objectives For Today â Introduction To Java â The Java Platform & The (JVM) Java Virtual Machine â Core Java (API) Application Programming.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
Client Side Programming Using Java Applet Outcomes: You will be expected to know: – Java Applets and HTML file; –bytecode and platform independent programs;
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
got ? Research Project – April 1998 Hang Xia, Mark Wang, Richard S. Chang Updated: R Norman, August 1999.
IC211 Object Oriented Programming Overview of Java.
Java: History and Introduction (Lecture # 1). History… Java – Based on C and C++ – Developed in 1991 for intelligent consumer electronic devices – Green.
Introduction to Java Kiyeol Ryu Java Programming Language.
Introduction to Java Programming, 4E
For more Lectures and Notes Visit
L EC. 01: J AVA FUNDAMENTALS Fall Java Programming.
01 Introduction to Java Technology. 2 Contents History of Java What is Java? Java Platforms Java Virtual Machine (JVM) Java Development Kit (JDK) Benefits.
LESSON 1 INTRODUCTION Compiled By: Edwin O. Okech [Tutor, Amoud University] JAVA PROGRAMMING.
Java PAL.  Contains the development kit and the runtime environment ( aka the Java Virtual Machine )  Download Link:
1 CSC 551: Web Programming Spring 2004 Java Overview  Design goals & features  platform independence, portable, secure, simple, object-oriented, … 
Advanced OOP MCS-3 OOP BSCS-3 Lecture # 1
BASIC JAVA PROGRAMMING TUTORIAL. History  James Gosling and Sun Microsystems  Oak  Java, May 20, 1995, Sun World  Hot Java –The first Java-enabled.
BA22001 Introduction to Java Instructor: Jingwu He.
Introduction to Java Programming with JBuilder 4
S.W. Ma/CIM/LWL41211/2 Prog. IIA Page 1 HKIVE (Lee Wai Lee Campus) Department of CIM Course : Year 2 Module : Programming IIA Textbook : Introduction.
Chapter 1 Introduction to Computers, Programs, and Java 1.
Java Workshop for Teachers May 6, 2005 A Brief Look at the Java Programming Language.
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.
Introduction to Java Programming. History F James Gosling and Sun Microsystems F Oak F Java, May 20, 1995, Sun World F HotJava –The first Java-enabled.
1.  At the end of this slide, student can:  Explore tools, features, properties and interface of the Textpad.  Creating a new project.  Open and run.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
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-
Chapter 1: Introduction to Programs, and Java 1. Objectives To review programs (§ ). To understand the relationship between Java and the World Wide.
POS 406 Java Technology And Beginning Java Code
Introduction to Java Programming with Forte Y. Daniel Liang.
1 Programming Fundamentals AITI-GP. 2 Introduction to Programming.
Getting Started Programming Programming consists of two steps: design (the architects) coding (the construction workers) Programming requires: a programming.
Introduction to Java Programming. Introduction Course Objectives Organization of the Book.
COP2800 – Computer Programming Using JAVA University of Florida Department of CISE Spring 2013 Lecture 35 – Overview of Java Web Programming Webpage:
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
Java and its Evolution. Contents Java Introduction Java Features How Java Differs from other OO languages Java and the World Wide Web Java Environment.
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: รัฐภูมิ เถื่อนถนอม
Intro to Applets. Applet Applets run within the Web browser environment Applets bring dynamic interaction and live animation to an otherwise static HTML.
Lecture 1. Introduction to Programming and Java MIT- AITI 2003.
Java -- A very Hot Object- Oriented Language Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
Introduction to Java Programming. 2 Chapter 1 Introduction to Java and Forte F What Is Java? F Getting Started With Java Programming –Create, Compile.
introductory lecture on java programming
1 Introduction to Java. 2 * 10% Assignments/ class participation * 10% Pop Quizzes * 05% Attendance * 25% Mid Term * 50% Final Term.
ITP 109 Week 2 Trina Gregory Introduction to Java.
Introduction to JAVA Programming
JAVA TRAINING IN NOIDA. JAVA Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented and specifically.
Introduction to Java Programming, 4E Y. Daniel Liang.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
CSE S. Tanimoto Java Introduction 1 Java A Programming Language for Web-based Computing.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
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.
Applications Active Web Documents Active Web Documents.
Object Oriented Programming in
Java™ 2 Platform Getting Started.
Chapter 1 Introduction to Computers, Programs, and Java
Chapter No. : 1 Introduction to Java.
What is Java? A programming language Fully buzzword-compliant:
Getting Started ARCS Lab..
(Computer fundamental Lab)
Java History, Editions, Version Features
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:

Getting Started

What is Java? A programming language –Fully buzzword-compliant: A simple, object oriented, distributed, interpreted, robust, secure, architecture neutral, portable, high performance, multithreaded, dynamic language. From: Java: An Overview James Gosling, Sun Microsystems, February 1995.

What Else is Java? According to Gosling: –“An environment” –“A platform” –“A way of thinking” –…ok, whatever Java is a phenomenon –Took the world by storm in 1995 when introduced with the HotJava web Browser –Quickly integrated with Netscape browser

Some History 1993 Oak project at Sun –small, robust, architecture independent, Object-Oriented, language to control interactive TV. –didn’t go anywhere 1995 Oak becomes Java –Focus on the web 1996 Java 1.0 available 1997 (March) Java some language changes, much larger library, new event handling model 1997 (September) Java 1.2 beta – huge increase in libraries including Swing, new collection classes, J2EE 1998 (October) Java 1.2 final (Java2!) 2000 (April) Java 1.3 final 2001 Java 1.4 final (assert) 2004 Java 1.5 (parameterized types, enum, …) (Java5!) 2005 J2EE 1.5

What is Java? Java is a general-purpose, high-level programming language. –The features of JavaThe features of Java Java program is both compiled and interpreted.compiled and interpreted Write once, run anywhere Java is a software-only platform running on top of other, hardware-based platforms.top of other, hardware-based platforms –Java Virtual Machine (Java VM) –The Java Application Programming Interface (JAVA API)

Features of Java Simple Architecture-neutral Object-Oriented Distributed Compiled Interpreted Statically Typed Multi-Threaded Garbage Collected Portable High-Performance Robust Secure Extensible Well-Understood

How Will Java Change My Life? Get started quickly Write less code Write better code Develop programs faster Avoid platform dependencies with 100% pure Java Write once, run anywhere Distribute software more easily

Java Applications and Java … lets Stand-alone Applications –Just like any programming language Applet –Run under a Java-Enabled Browser Midlet –Run in a Java-Enabled Mobile Phone Servlet –Run on a Java-Enabled Web Server Switchlet –…

Java Developer's Kit (I) Java's programming environment –Core Java API –compiler –interpreter –debugger –dis-assembler –profiler –more...

Java Developer's Kit (II) Java Compiler Java Interpreter Java SourceJava Bytecode Compile Run.java.class Java Dis-assembler

Prepare and Execute Java Source Computer Java Program Compilation Java ByteCode Your computer Java ByteCodeExecution Restricted Env. Verification Internet

Write Once, Run Anywhere

ByteCode: Food for the VM For most languages, compilation produces machine code Java compilation produces “bytecode” –Intermediate code readable by the VM –Transferable across the Internet as applets VM interprets BC into instructions –Partly responsible for performance lag ByteCode produced on any platform may be executed on any other platform which supports a VM

virtual machine execution model of Java source (text) compiler CPU bytecode interpreter bytecode interpreter dynamic loading JIT compiler JIT compiler compiled code compiled code JVML verifier bytecode (aka. class file)

The JIT Just-In-Time compiler Translates bytecode into machine code at runtime –1-time overhead when run initiated –Performance increase times Now the default for most JVM’s –Can be turned off if desired –JIT can apply statistical optimizations based on runtime usage profile

Not just one JVM, but a whole family JVM (J2EE & J2SE) –Well-known Java Virtual Machine. CVM, KVM (J2ME) –Small devices. –Reduces some VM features to fit resource- constrained devices. JCVM (Java Card) –Smart cards. –It has least VM features. And there are also lots of other JVMs

Java Platform & VM & Devices

Java VM and API Java API and Virtual Machine insulate the Java program from hardware dependencies. Java API

Collection of ready- made software components that provide many useful capabilities. Grouped into libraries (packages) of related components. Core API –Essentials: Object, String, Input and Output... –Applets –Networking –Internationalization –Security –Software Components –Object Serialization –Java Database Connectivity (JDBC)

The “Hello World” Application

Create a Java Source File public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } }

Compile and Run Compile –javac HelloWorld.java One file named HelloWorld.class is created if the compilation is succeeds. Run –java HelloWorld

The Simplest Java Application: Hello,World! Since Java is object-oriented, programs are organized into modules called classes, which may have data in variables and subroutines called methods. class HelloWorld { public static void main (String[] args) { System.out.println(“Hello World!”); } Each program is enclosed in a class definition. main() is the first method that is run. The notation class.method or package.class.method is how to refer to a public method (with some exceptions). Syntax is similar to C - braces for blocks, semicolon after each statement. One difference: upper and lower case matter!

The “Hello World” Applet

Create a Java Source File HelloWorldApplet.java import java.applet.Applet; import java.awt.Graphics; public class HelloWorldApplet extends Applet { public void paint(Graphics g) { g.drawString(“Hello World!”, 5, 25); } }

Compile the Source File javac HelloWorldApplet.java One file named HelloWorldApplet.class is created if the compilation is succeeds.

Displaying your applet from a Web page. Create an HTML file with an applet tag to display the results of drawing the applet. Simple Hello Page My Java applet says: Name of your applet class. The browser will use a rectangle of width 150 pixels and height 25 pixels to display the applet within the other html.

The Simplest Java Applet: Hello, World! Java applets are part of the class hierarchy that can call methods to display on a screen (within the browser window). One way to draw on the screen is to call the method drawString from the standard method paint. import java.awt.Graphics; public class HelloWorldApplet extends java.applet.Applet { public void paint (Graphics g) { g.drawString(“Hello World!”, 5, 25); } The import statement allows the use of methods from the Graphics class without the dot notation. The paint method displays a graphics object on the screen - one of the standard methods that takes the place of main for applets. Puts this as a subclass of Applet.

No main method Yes, applets have a main method......but it's in the browser, not in your code! More about that later in the course …