EE2E1. JAVA Programming Introduction Dr. Mike Spann

Slides:



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

Android architecture overview
Introduction To Java Objectives For Today â Introduction To Java â The Java Platform & The (JVM) Java Virtual Machine â Core Java (API) Application Programming.
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 Kiyeol Ryu Java Programming Language.
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.
Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department.
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.
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,
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.
BASIC JAVA PROGRAMMING TUTORIAL. History  James Gosling and Sun Microsystems  Oak  Java, May 20, 1995, Sun World  Hot Java –The first Java-enabled.
CSC 142 A 1 CSC 142 Introduction to Java [Reading: chapter 0]
+ Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming.
CSCI 224 Introduction to Java Programming. Course Objectives  Learn the Java programming language: Syntax, Idioms Patterns, Styles  Become comfortable.
Advanced Java New York University School of Continuing and Professional Studies.
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
About the Java  Java technology is both a programming language and a platform –The Java Programming Language A high-level language that can be characterized.
Programming Fundamentals 2: Background/ F II Objectives – –give a non-technical overview of Java Semester 2, Background.
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.
About this course? EE2E1 (MS) EE2E1 (MS)  Introduction to Java programming  Basic ideas about objects and classes  We will also look at more advanced.
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.
Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.
Chapter 17: Applets, Images, and Sound. Objectives Learn about applets Write an HTML document to host an applet Use the init() method Work with JApplet.
Chapter 34 Java Technology for Active Web Documents methods used to provide continuous Web updates to browser – Server push – Active documents.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
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-
POS 406 Java Technology And Beginning Java Code
1 Programming Fundamentals AITI-GP. 2 Introduction to Programming.
Introduce to Java. Outline History of Java History of Java Something about Java Something about Java Brief introduction to Java programming Brief introduction.
CS 3131 Introduction to Programming in Java Rich Maclin Computer Science Department.
Java Programming, 2E Introductory Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
Java Applets. 2 Introduction to Java Applet Programs Applications are ___________________ programs –executed with Java interpreter Applet is a small program.
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
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.
JAVA Programming “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
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.
Client-Server applications Introduction to Java Applets Client-server architectures Why do Applets exist? What can an Applet do?
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
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.
Object Oriented Programming Course Introduction Dr. Mike Spann
Introduction to 1. What is Java ? Sun Microsystems Java is a programming language and computing platform first released by Sun Microsystems in The.
JAVA TRAINING IN NOIDA. JAVA Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented and specifically.
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.
Introduction to Algorithm. What is Algorithm? an algorithm is any well-defined computational procedure that takes some value, or set of values, as input.
The Basics of Android App Development Sankarshan Mridha Satadal Sengupta.
Applications Active Web Documents Active Web Documents.
A Programming Language for Web-based Computing with Graphics
Chapter 1 Introduction to Computers, Programs, and Java
What is Java? A programming language Fully buzzword-compliant:
Introduction Enosis Learning.
CMPE419 Mobile Application Development
Introduction Enosis Learning.
Getting Started ARCS Lab..
Java Applets.
A Programming Language for
(Computer fundamental Lab)
F II 1. Background Objectives
Introducing Java.
CMPE419 Mobile Application Development
A Programming Language for
A Brief History January 1996: first official release JDK 1.0
Presentation transcript:

EE2E1. JAVA Programming Introduction Dr. Mike Spann

Contents Java is just another programming language (eg. C & C++). So why bother to learn Java? Java is just another programming language (eg. C & C++). So why bother to learn Java?

Java is …… Portable Portable Object oriented Object oriented Robust Robust Multi-threaded Multi-threaded Graphical Graphical Connected Connected Extensive Extensive

Java applications and applets Applications – standalone Java programs Applications – standalone Java programs Applets – Java programs that run inside web browsers Applets – Java programs that run inside web browsers

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

‘Hello world’ applet class HelloWorldPanel extends JPanel { public void paintComponent(Graphics g) { super.paintComponent(g); Font f=new Font(“SansSerif”,Font.BOLD,36); g.setFont(f); g.drawString("Hello World!", 50, 120); } public class HelloWorldApplet extends JApplet { public void init() { Container contentPane = getContentPane(); contentPane.add(new HelloWorldPanel()); }

‘Hello World’ html file

Run the ‘Hello World’ applet %20Stuff/HelloWorldApplet/HelloWorld Applet.html %20Stuff/HelloWorldApplet/HelloWorld Applet.html %20Stuff/HelloWorldApplet/HelloWorld Applet.html %20Stuff/HelloWorldApplet/HelloWorld Applet.html

Portable Java Java is ‘program once – run anywhere’ Java is ‘program once – run anywhere’ A Java program is compiled to bytecodes A Java program is compiled to bytecodes Bytecodes interpreted by the Java Virtual Machine Bytecodes interpreted by the Java Virtual Machine

Object Oriented Java Object oriented programming is concerned with objects and their : State State Behavior Behavior

Example Example  A bank account transfer() withdraw() balance account number State Behaviour

class BankAccount { public void transfer(int amount); public void withdraw(int amount); private: int balance; int accountNumber; }

Robust Java Java is easier than C or C++! Java is easier than C or C++! Java has better memory management than C or C++ Java has better memory management than C or C++ You don’t need pointers for accessing arrays or strings in Java You don’t need pointers for accessing arrays or strings in Java No chance of dangling pointers or memory leaks in Java No chance of dangling pointers or memory leaks in Java

Multi-threaded Java A thread is a sequence of executing statements in a program A thread is a sequence of executing statements in a program A multi-threaded program comprises a number of threads which run in parallel (but only one thread is being executed at one time) A multi-threaded program comprises a number of threads which run in parallel (but only one thread is being executed at one time) Java supports multi-threading as an intrinsic part of the language – multi- threading is easy in Java! Java supports multi-threading as an intrinsic part of the language – multi- threading is easy in Java!

A single-threaded program A multi-threaded program

Example – A sort demo Multi-threaded Sorting Applet Multi-threaded Sorting Applet Multi-threaded Sorting Applet Multi-threaded Sorting Applet

Graphical Java Abstract widget toolkit (AWT) + User interface library Swing Abstract widget toolkit (AWT) + User interface library Swing Swing is a collection of user interface components (buttons, menus, dialogue boxes etc) Swing is a collection of user interface components (buttons, menus, dialogue boxes etc) AWT does the event handling AWT does the event handling

Example 1. A tic-tac-toe applet %20Stuff/TicTacToeApplet/example1.htm l %20Stuff/TicTacToeApplet/example1.htm l %20Stuff/TicTacToeApplet/example1.htm l %20Stuff/TicTacToeApplet/example1.htm l

Example 2. Full swing set demo %20Stuff/SwingSetApplet/SwingSetApp let.html %20Stuff/SwingSetApplet/SwingSetApp let.html %20Stuff/SwingSetApplet/SwingSetApp let.html %20Stuff/SwingSetApplet/SwingSetApp let.html

Connected Java Networking is easy in Java! Networking is easy in Java! Java has classes and methods for network programming. Java has classes and methods for network programming. A Java program can easily access a web- site through a URL connection A Java program can easily access a web- site through a URL connection Java programs can be be written which implement both client and server side processing Java programs can be be written which implement both client and server side processing

Example – simple web browser %20Stuff/BookMarkApplet/BookMark.h tml %20Stuff/BookMarkApplet/BookMark.h tml %20Stuff/BookMarkApplet/BookMark.h tml %20Stuff/BookMarkApplet/BookMark.h tml

So what is Java? Java consists of 2 things : The Java Virtual Machine (Java VM) The Java Virtual Machine (Java VM) The Java Application Programming Interface (Java API) The Java Application Programming Interface (Java API)

Java VM runs the Java bytecode on the different hardware platforms Java VM runs the Java bytecode on the different hardware platforms Java API is a large collection of ready- made software components Java API is a large collection of ready- made software components  You can add additional API’s to this layer  Graphics, numerical, image processing etc The Java API is grouped into libraries of related classes and interfaces; these libraries are known as packages. The Java API is grouped into libraries of related classes and interfaces; these libraries are known as packages.

My Java program Java API Java VM HardwareOther API’s

Java API java langawtio Math String Thread Graphics MathButton Color File InputStream OutputStream sqrt() exp()

Java API documentation can be found online at :

Extensive Java – Java technology Java has additional API’s covering a wide range of software technologies Java has additional API’s covering a wide range of software technologies  Java2D – 2D graphics  Java3D – 3D graphics  Java Advanced Imaging (JAI) – image processing

 Java Speech API – speech processing  Java Media Framework API – multi-media application  JavaBeans – re-useable user interface components  Java Servlets – extending web server functionality  Java Message Service (JMS) – allowing programs to exchange messages  Java Telephony API – computer telephony

 Java TV API – interactive digital TV  JavaMail API – applications  JDBC – Java database API

Examples Java2D API Java2D API  aching/java/lab-guides/getting- started/demo/jfc/Java2D/Java2D.html aching/java/lab-guides/getting- started/demo/jfc/Java2D/Java2D.html aching/java/lab-guides/getting- started/demo/jfc/Java2D/Java2D.html Java 3D API Java 3D API 

Java resources Sun’s Java home page Sun’s Java home page  Java online tutorial Java online tutorial  Comparing C++and Java Comparing C++and Java  ml ml ml Textbook Textbook  Core Java 2. Volume 1-Fundamentals Core Java 2 Core Java 2  C.S.Horstmann, G. Cornell  Amazon Link Amazon Link Amazon Link My web page My web page  k/spannm/Courses/ee2e.h tm k/spannm/Courses/ee2e.h tm k/spannm/Courses/ee2e.h tm

OK, so why should I learn Java? Main reason, Java is object oriented Main reason, Java is object oriented   What is OOP good for?   Modelling asynchronously interacting objects GUIs Event simulation Ray tracing visualisation CAD simulation Real-time control/embedded systems Robotics Image/Video processing Client/Server systems etc

OK, so why should I learn Java? Java is free to download and is easy to learn Java is free to download and is easy to learn Java has powerful (and free!) development tools e.g. Eclipse, Netbeans Java has powerful (and free!) development tools e.g. Eclipse, Netbeans Excellent documentation support – Javadocs Excellent documentation support – Javadocs Great community support Great community support Rich collection of open source libraries Rich collection of open source libraries Can develop Android apps in Java – supported by Eclipse and Netbeans Can develop Android apps in Java – supported by Eclipse and Netbeans  Android is a good platform for mobile apps because of  Android is a good platform for mobile apps because of ease of release, wide range of devices and its an open platform

So what about this course? EE2E1 (MS) EE2E1 (MS)  Introduction to Java programming  Basic ideas about objects and classes  We will also look at more advanced features of Java GraphicsGraphics Files and streamsFiles and streams Multi-threadingMulti-threading NetworksNetworks EE2E2 (DP) EE2E2 (DP)  Object Oriented Software Design

Assessment EE2E1 and EE2E2 are assessed jointly (making up the EE2E module) EE2E1 and EE2E2 are assessed jointly (making up the EE2E module) EE2E1 is assessed through a classtest and programming exercises and a major programming assignment EE2E1 is assessed through a classtest and programming exercises and a major programming assignment  15% through a 1 hour class test  2 x 22.5% through 2 programming exercises  40% through a major programming assignment carried out in semester 2