Basic Java Seminar 2/2 Novemberr 5, 1997 SPARCS Nam Sedong Seminars on 4th SPARCS Exhibition - The second one.

Slides:



Advertisements
Similar presentations
Java Applets:. How Applets differ from application?: They do not use main method but init(), start() and paint() methods of the applet class They can.
Advertisements

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 Vijayan Sugumaran School of Business Administration Oakland University Rochester, MI
Java Applet & JavaScript SNU OOPSLA Lab. October 2005.
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.
Principles of Object-Oriented Software Development The language Java.
Created by Ron Beglieter (based on the Java Tutorial) 1 What is Java? Java technology is both a programming language and a platform; Programming Language.
Lecture 1: Overview of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++ Designed.
Developing User Interfaces (DUI) Chris North cs3724: HCI.
Getting Started What is Java? A programming language –Fully buzzword-compliant: A simple, object oriented, distributed, interpreted, robust, secure,
Java Software Solutions Lewis and Loftus Chapter 2 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Software Concepts -- Introduction.
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.
Applets  The Applet Class  The HTML Tag F Passing Parameters to Applets.
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.
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.
Intro to Java 2 By Geb Thomas Based on the Java TutorialJava Tutorial.
Introduction to Java CSIS 3701: Advanced Object Oriented Programming.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
University of Houston-Clear Lake Proprietary© 1997 Evolution of Programming Languages Basic cycle of improvement –Experience software difficulties –Theory.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and Server Side Programming Very rich GUI libraries Portability (machine independence) A.
CIS 644 Aug. 25, 1999 tour of Java. First … about the media lectures… we are experimenting with the media format please give feedback.
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
© 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
CIS3023: Programming Fundamentals for CIS Majors II Summer 2010 Ganesh Viswanathan Introduction to Applets Course Lecture Slides 29 th July 2010.
The Joy of Programming (also known as) Introduction to Object-Oriented Programming.
CS 3131 Introduction to Programming in Java Rich Maclin Computer Science Department.
University of Houston-Clear Lake Proprietary© 1997 Summary of Chapter 3 A class is a collection of data and methods that operate on that data. An object.
1 Introduction to Java. 2 What is Java? A programming language. A platform –A virtual machine (JVM) definition. –Runtime environments in diverse hardware.
CSC 205 – Java Programming II Applet. Types of Java Programs Applets Applications Console applications Graphics applications Applications are stand-alone.
Program that runs in appletviewer (test utility for applets) Web browser (IE, Communicator) Executes when HTML (Hypertext Markup Language) document containing.
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
1 Programming Java Java Basics. 2 Java Program Java Application Program Application Program written in general programming language Applet Program running.
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.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and web applications Very rich GUI libraries Portability (machine independence) A real Object.
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.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
Java -- A very Hot Object- Oriented Language Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of.
CSI 3125, Preliminaries, page 1 Applet. CSI 3125, Preliminaries, page 2 Applet An applet is a Java program that runs in a Web browser. An applet can be.
CHAPTER Agenda Applets Servelets Browsers HelloWorld.
3/5/2002e-business and Information Systems1 Java Java Java Virtual Machine (JVM) Java Application Program Interface (API) HW Kernel API Application Programs.
Java Computer Industry Lab. 1 Programming Java Java Basics Incheon Paik.
Know Your Java. Java is special Java source code Byte code/ native code Object code on windows Object code on Dos Object code on Lynux.
ITP 109 Week 2 Trina Gregory Introduction to Java.
WEEK 2 1 Software Concepts -- Introduction Now we can begin to examine the basic ideas behind writing programs Chapter 2 focuses on: history.
Features of JAVA PLATFORM INDEPENDENT LANGUAGE JAVA RUNTIME ENVIRONMENT (JRE) JAVA VIRTUAL MACHINE (JVM) JAVA APP BYTE CODE JAVA RUNTIME ENVIRONMENT.
CSE S. Tanimoto Java Introduction 1 Java A Programming Language for Web-based Computing.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Object Oriented Programming in
JAVA MULTIPLE CHOICE QUESTION.
A Programming Language for Web-based Computing with Graphics
Chapter No. : 1 Introduction to Java.
Internet and Java Foundations, Programming and Practice
What is Java? A programming language Fully buzzword-compliant:
Getting Started ARCS Lab..
A Programming Language for
(Computer fundamental Lab)
11.1 Applets & graphics.
Chap 1. Getting Started Objectives
Chap 4. Programming Fundamentals
JAVA APPLET PREPARED BY Mr. Jahanzaib Ahmed
A Programming Language for
A Brief History January 1996: first official release JDK 1.0
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:

Basic Java Seminar 2/2 Novemberr 5, 1997 SPARCS Nam Sedong Seminars on 4th SPARCS Exhibition - The second one

What is Java? A way to make Web pages sexy? A language like C++, Smalltalk? Computing Platform –Java Programming Language –Java (Virtual) Machine (JVM) –Java API (Application Programmers’ Interface) MFC

Java Language C –Object Oriented –no multiple inheritance –no operator overloading –No pointer Secure Thread-safe Exception Handling Architecture Neutral Internationalization –Unicode, 2 byte char Garbage Collection Standardization –sizeof( int ) Packages Network Oriented –Class loading

Java Virtual Machine The engine that actually executes a Java program key to many of Java’s features –portability (Write once, run anywhere) –efficiency –security (Sandbox) virtual processor, virtual memory… Used in JDK, JRE, browsers

Java API package java.awt package java.awt.datatransfer package java.awt.event package java.awt.image package java.beans package java.io package java.lang package java.lang.reflect package java.math package java.net package java.rmi package java.rmi.dgc package java.rmi.registry package java.rmi.server package java.security package java.security.acl package java.security.interfaces package java.sql package java.text package java.util package java.util.zip

Application & Applets Application –standalone programs –HotJava browser Applet –a Java program to be included in HTML pages and executed in a Java-compatible browser.

How Applet Run? Java Source Code Compile Java Class File Network Web Browser

Before You go on JDK(Java Development Kit) Java-compatible browser References –Java Tutorial HTML format –Java API Documentation You can find many resources about Java at

Hello World Application /** * The HelloWorldApp class implements an application that * simply displays "Hello World!" to the standard output. */ class HelloWorldApp { public static void main(String[] args) { System.out.println("Hello World!"); //Display the string. }

Compiling JDK: –UNIX: javac HelloWorld.java –DOS shell (Windows 95/NT): javac HelloWorld.java Other Visual Development Tools: –Maybe, you can find “Compile” button, or etc. Output: HelloWorld.class

Running Run the program using the Java interpreter. JDK –java HelloWorldApp Other Visual Development Tools: –Maybe, you can find “Compile” button, or etc.

Variables and Data Types Primitive Type –char 2byte, UNICODE –boolean true or false Reference Type C data types Not supported –pointer, struct, union

Class java.lang.String String a = new String( “abc” ); String b; b = new String( “def” ); String c = “abc”; System.out.println( a.length( ) ); System.out.println( a.substring( 5, 10 ) ); System.out.println( a + b ); System.out.println( a == “abc” ); System.out.println( a.equals( “abc” ) ); System.out.println( c == “abc” ); String d = “This is”.concat( “String” );

Class java.lang.Math int a; a = Math.max( -5, -10 ); a = Math.abs( a ); int pi = Math.PI; a = ( int )Math.max( -9.0, );

java.util.Vector Vector() Vector(int) Vector(int, int) addElement(Object) capacity() contains(Object) copyInto(Object[]) elementAt(int) elements() firstElement() indexOf(Object)...

Class java.util.Stack public class Stack extends Vector { public Object push(Object item); public Object pop() throws EmptyStackException; public Object peek() throws EmptyStackException; public boolean empty(); public int search(Object o); }

Abstract Window Toolkit(AWT) GUI, Look and Feel Components –Button, Frame, Panel, TextField,... Event Handling –MouseListener, ComponentListener,... Layout –GridLayout, FlowLayout, …

AWT Component Hierarchy

HelloSPARCS Application A button turn in to red when pressed –Add components to a container –Add a listener to a component –Multiple class in a file

HelloSPARCS.java 1/3 import java.awt.*; import java.awt.event.*; public class HelloSPARCS { public static void main( String[] args ) { Frame f = new Frame( "HelloSPARCS" ); f.add( new SPARCSButton( ) ); f.pack(); f.show(); }

Hello SPARCS.java 2/3 class SPARCSButton extends Button { public SPARCSButton( ) { this.setLabel( "SPARCS" ); this.addMouseListener( new SPARCSButtonAdapter( ) ); } public SPARCSButton( Color argC ) { this.setBackground( argC ); this.addMouseListener( new SPARCSButtonAdapter( ) ); }

Hello SPARCS.java 3/3 class SPARCSButtonAdapter extends MouseAdapter { public void mouseClicked( MouseEvent argME ) { if ( argME.getSource( ) instanceof SPARCSButton ) { ( ( SPARCSButton )argME.getSource( ) ).setBackground( Color. red ); } else { System.err.println( "ERROR:... " ); }

Hello World Applet import java.applet.Applet; import java.awt.Graphics; public class HelloWorld extends Applet { public void paint(Graphics g) { g.drawString("Hello world!", 50, 25); }

Class java.awt.Graphics Various devices, as well as onto off-screen images. Component.getGraphics( ) –origin –clip –color –font. –XOR

repaint( ) Another Thread for AWT repaint( ) –may not be called –final state update( Graphics g) paint( Graphics g)

HW.html(Calling an Applet) A Simple Program

The Life Cycle of an Applet public class Simple extends Applet {... public void init() {... } public void start() {... } public void stop() {... } public void destroy() {... }... }

한글 ? Unicode? char –2byte String Unicode 2.0 –2 byte 한글로 된 변수이름을 쓸 수 있다.

Java 의 미래 ? Today, 5 times slower than C++ –Just In-Time(JIT) compiler –JAR Write Once, Run Anywhere? –Java Foundation Class Assembly  C JavaBeans - Software Component JavaStation - (Not Virtual)Machine

References l 전문가로 큰다, 김도형 (dynaxis), 마이크로소프트웨어 Java Unleashed, Sams net Java Virtual Machine, Jon Meyer&Troy Downing, O’Reilly

Contact Information Office: Off-line: SPARCS room