Introduction to Java Programming - PowerPoint PPT Presentation

1 / 33
About This Presentation
Title:

Introduction to Java Programming

Description:

Core Java classes (Swing, exception, internationalization, multithreading, ... Sun's Forte (RAD) Getting Started with Java Programming. A Simple Java Application ... – PowerPoint PPT presentation

Number of Views:156
Avg rating:3.0/5.0
Slides: 34
Provided by: csieM
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Java Programming


1
Introduction toJava Programming
2
Introduction
  • Course Objectives
  • Organization of the Book

3
Course Objectives
  • Upon completing the course, you will understand
  • Java applications and applets
  • Primitive data types
  • Java control flow
  • Methods
  • Object-oriented programming
  • Core Java classes (Swing, exception,
    internationalization, multithreading, multimedia,
    I/O, networking)

4
Course Objectives, cont.
  • You will be able to
  • Write applications and applets
  • Develop a GUI interface
  • Write interesting projects
  • Establish a firm foundation on Java concepts

5
Book Chapters
  • Part I Fundamentals of Programming
  • Chapter 1 Introduction to Java
  • Chapter 2 Primitive Data Types and Operations
  • Chapter 3 Control Statements
  • Chapter 4 Methods

6
Book Chapters, cont.
  • Part II Object-Oriented Programming
  • Chapter 5 Programming with Objects and Classes
  • Chapter 6 Class Inheritance
  • Chapter 7 Arrays and Vectors

7
Book Chapters, cont.
  • Part III Graphics Programming
  • Chapter 8 Getting Started with Graphics
    Programming
  • Chapter 9. Creating User Interfaces
  • Chapter 10. Applets and Advanced Graphics

8
Book Chapters, cont.
  • Part IV Developing Comprehensive Projects
  • Chapter 11. Exception Handling
  • Chapter 12. Internationalization
  • Chapter 13. Multithreading
  • Chapter 14. Multimedia
  • Chapter 15. Input and Output
  • Chapter 16. Networking

9
Chapter 1 Introduction to Java
  • Course Objectives
  • What Is Java?
  • Getting Started With Java Programming
  • Compiling and Running a Java Application
  • Compiling and Running a Java Applet

10
What Is Java?
  • History
  • Characteristics of Java

11
History
  • James Gosling
  • Oak
  • Java, May 20, 1995, Sun World
  • HotJava
  • The first Java-enabled Web browser

12
Characteristics of Java
  • Java is simple
  • Java is object-oriented
  • Java is distributed
  • Java is interpreted
  • Java is robust
  • Java is secure
  • Java is architecture-neutral
  • Java is portable
  • Javas performance
  • Java is multithreaded
  • Java is dynamic

13
Different Versions of Java
  • Standard Edition, J2SE
  • Core of programming language
  • Enterprise Edition, J2EE
  • For enterprise applications
  • Micro Edition, J2ME
  • For small devices

14
(No Transcript)
15
J2SE
16
J2EE Architecture
17
J2ME
18
JDK Versions
  • JDK 1.02 (1995)
  • JDK 1.1 (1996)
  • Java 2 SDK v 1.2 (a.k.a JDK 1.2, 1998)
  • Java 2 SDK v 1.3 (a.k.a JDK 1.3, 2000)
  • Java 2 SDK v 1.4 (a.k.a JDK 1.4, 2002)

19
Java Language Specification
  • The application programming interface (API) of
    Java
  • http//java.sun.com/j2se/1.4.1/docs/api/
  • You can also download the document to your local
    PC
  • http//java.sun.com/j2se/1.4.1/docs/index.html

20
Java IDE Tools
  • Inprise JBuilder (RAD)
  • Microsoft Visual J
  • Symantec Café (RAD)
  • Rouge Wave JFactory
  • Sun Java Workshop
  • IBM Visual Age for Java (RAD)
  • Suns Forte (RAD)

21
Getting Started with Java Programming
  • A Simple Java Application
  • Compiling Programs
  • Executing Applications
  • A Simple Java Applet
  • Viewing Java Applets
  • Applications vs. Applets

22
A Simple Application
  • Example 1.1
  • //This application program prints Welcome
  • //to Java!
  • public class Welcome
  • public static void main(String args)
  • System.out.println("Welcome to Java!")

23
Compiling Programs
  • On command line
  • javac file.java

24
Executing Applications
  • On command line
  • java classname

25
Example
  • javac Welcome.java
  • java Welcome
  • output...

26
A Simple Applet (Optional)
  • Example 1.2
  • / This is an example of Java applets /
  • import java.awt.Graphics
  • public class WelcomeApplet
  • extends java.applet.Applet
  • public void paint (Graphics g)
  • g.drawString("Welcome to Java!",10,10)

27
Creating an HTML File
  • lthtmlgt
  • ltbodygt
  • ltapplet code"WelcomeApplet.class"
  • width 100 height 40gt
  • lt/appletgt
  • lt/bodygt
  • lt/htmlgt

28
Viewing Java Applets
29
Applet Viewer Utility
  • appletviewer htmlfile.html
  • Example
  • appletviewer WelcomeApplet.html

30
Applications vs. Applets
  • Similarities
  • Differences

31
Security Restrictions on Applets
  • Applets are not allowed to read from, or write
    to, the file system of the computer viewing the
    applets.
  • Applets are not allowed to run any programs on
    the browsers computer.
  • Applets are not allowed to establish connections
    between the users computer and another computer
    except with the server wherethe applets are
    stored.

32
JBuilder
  • User interface of JBuilder
  • Creating a project
  • Editing a Java program
  • Compiling a Java program
  • Executing a Java program

33
Anatomy of a Java Program
  • Comments
  • Packages
  • Reserved words
  • Modifiers
  • Statements
  • Blocks
  • Classes
  • Methods
  • The main Method
Write a Comment
User Comments (0)
About PowerShow.com