java outline n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Java Outline PowerPoint Presentation
Download Presentation
Java Outline

Loading in 2 Seconds...

play fullscreen
1 / 33

Java Outline - PowerPoint PPT Presentation


  • 124 Views
  • Uploaded on

Java Outline. Intro and Applications Applets and GUI Client / Server RMI, JDBC. Background. Objective: Platform independent C++ 1991 - 1994 Oak 1994 - JAVA Virtual Machine / Interpreter. Java “Buzzwords”. Simple Object-Oriented Network-Savy Robust Secure Architecture neutral

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Java Outline' - ossie


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
java outline
Java Outline
  • Intro and Applications
  • Applets and GUI
  • Client / Server
  • RMI, JDBC

CS423 (cotter)

background
Background
  • Objective: Platform independent C++
  • 1991 - 1994 Oak
  • 1994 - JAVA
  • Virtual Machine / Interpreter

CS423 (cotter)

java buzzwords
Java “Buzzwords”

Simple Object-Oriented

Network-Savy Robust

Secure Architecture neutral

Portable Interpreted

High Performance Multi-threaded

Dynamic

CS423 (cotter)

java implementation
JAVA Implementation

Java program

Java program

Java program

Java program

Java Cmds

Java Cmds

Java Cmds

VM

VM

VM

SPARC

PowerPC

Intel

CS423 (cotter)

extension to internet
Extension to Internet
  • Timing with Internet growth
  • Same functionality needed
  • Just implement a new tag (applet)
  • Browser loads web page & applet

CS423 (cotter)

operations environments
Operations Environments
  • Applications program (~DOS window)
    • supports file access
  • Applet (browser)
    • supports Internet linkages.

CS423 (cotter)

object oriented concepts
Object Oriented Concepts
  • Intent is to model the environment
  • Combine attributes with functions

CS423 (cotter)

oo structure audio clip

Play

Wave Data

Stop

whatever...

Characteristics

Current track

Record

OO Structure(audio clip)

CS423 (cotter)

oo vs procedures
OO vs. Procedures

function

function

function

function

Global Data

Play

Play clip

Audio Player

Wave Data

whatever...

Stop

stop

Characteristics

Current track

record clip

Record

CS423 (cotter)

oo concepts
OO Concepts
  • Inheritance
    • Integer
    • Myinteger (with min and max fields)
  • Method Overloading
    • public String(char value[]);
    • public String(char value[], int offset, int count);
  • Polymorphism
    • public int hashCode();

CS423 (cotter)

oo class relationships
OO Class Relationships
  • use (call a method, etc.)
  • containment (“has-a”)
  • inheritance (is-a”)

CS423 (cotter)

oo structure
OO Structure
  • class
    • data
      • public
      • private
    • methods
      • constructor
      • destructor
      • others

CS423 (cotter)

java structure
Java Structure

class HelloApplication

{

public static void main (String argv[])

{

String message[] = new String[2];

message[0] = "Welcome to CS490D";

message[1] = "The subject is JAVA!";

System.out.println (message[0]);

System.out.println (message[1]);

}

}

CS423 (cotter)

java support environments
Java Support Environments
  • JDK 1.0.2, JDK 1.1.4, JDK 1.2.2
  • Borland JBuilder
  • Semantic Cafe
    • just-in-time compiler
  • Visual J++
  • etc.

CS423 (cotter)

java info sources
Java Info Sources
  • http:/java.sun.com
    • The home for Java
  • http://www.gamelan.com/
    • central repository for info
  • MANY others.

CS423 (cotter)

java language structure packages 1 0 2
Java Language Structure - Packages (1.0.2)
  • java.lang - basic classes (objects, strings, threads, etc.)
  • java.io - stream mgmt for files, strings, other sources
  • java.util - time, rand, generic data struct..
  • java.net - URLs, TCP, UDP, IP, binary to text
  • java.awt - manages user interface components
  • java.awt.image - manage image data
  • java.awt.peer - platform specific implementation links
  • java.applet - Applet class, interfaces to resources

CS423 (cotter)

java lang
java.lang
  • Object
  • Process
  • Runtime
  • Thread
  • Math
  • String
  • Integer
  • etc……

CS423 (cotter)

java lang object
java.lang.Object

public class java.lang.Object

{

// Constructors

public Object(); §1.12.1

// Methods

protected Object clone(); §1.12.2

public boolean equals(Object obj); §1.12.3

protected void finalize(); §1.12.4

public final Class getClass(); §1.12.5

public int hashCode(); §1.12.6

public final void notify(); §1.12.7

public final void notifyAll(); §1.12.8

public String toString(); §1.12.9

public final void wait(); §1.12.10

public final void wait(long timeout); §1.12.11

public final void wait(long timeout, int nanos); §1.12.12

}

CS423 (cotter)

java lang integer
java.lang.integer

public final class java.lang.Integer

extends java.lang.Number (I-§1.11)

{

// Fields

public final static int MAX_VALUE; §1.8.1

public final static int MIN_VALUE; §1.8.2

// Constructors

public Integer(int value); §1.8.3

public Integer(String s); §1.8.4

CS423 (cotter)

java lang integer1
java.lang.integer

// Methods

public double doubleValue(); §1.8.5

public boolean equals(Object obj); §1.8.6

public float floatValue(); §1.8.7

public static Integer getInteger(String nm); §1.8.8

public static Integer getInteger(String nm, int val); §1.8.9

public static Integer getInteger(String nm, Integer val); §1.8.10

public int hashCode(); §1.8.11

public int intValue(); §1.8.12

public long longValue(); §1.8.13

public static int parseInt(String s); §1.8.14

public static int parseInt(String s, int radix); §1.8.15

public static String toBinaryString(int i); §1.8.16

public static String toHexString(int i); §1.8.17

public static String toOctalString(int i); §1.8.18

public String toString(); §1.8.19

public static String toString(int i); §1.8.20

public static String toString(int i, int radix); §1.8.21

public static Integer valueOf(String s); §1.8.22

public static Integer valueOf(String s, int radix); §1.8.23

}

CS423 (cotter)

building java applications using java development kit
Building Java Applications Using Java Development Kit
  • Get a copy of the JDK (java.sun.com, etc.)
  • Install the development kit (tools and classes)
  • Create MyApp.java source file
    • text editor (notepad, etc.)
    • winedit, Café, etc.
  • Compile .java file to create .class file
    • javac MyApp.java
  • Run application (.class file) through java VM
    • java MyApp

CS423 (cotter)

sample java app
Sample Java App

G:\Data\Java\MyHelloApp>type MyHelloApp.java

class MyHelloApp

{

public static void main (String argv[])

{

String message[] = new String[2];

message[0] = "Welcome to CS423";

message[1] = "The subject is JAVA!";

System.out.println (message[0]);

System.out.println (message[1]);

}

}

CS423 (cotter)

sample java app1
Sample Java App

G:\Data\Java\MyHelloApp>javac MyHelloApp.java

G:\Data\Java\MyHelloApp>java MyHelloApp

Welcome to CS423

The subject is JAVA!

G:\Data\Java\MyHelloApp>

CS423 (cotter)

add interaction with user
Add Interaction with User

class ParmApplication

{

public static void main (String argv[])

{

int i;

if (argv.length == 0)

{

System.out.println ("");

System.out.println (" Put parameters on the "

+ "command line. Here is the syntax:");

CS423 (cotter)

add interaction with user1
Add Interaction with User

System.out.println ("");

System.out.println ("java ParmApplication Parm0 "

+ "Parm1 Parm2 [...]");

System.out.println ("");

System.exit (1);

}

System.out.println ("");

System.out.println (" " + argv.length

+ " string parameter(s) entered:");

CS423 (cotter)

add interaction with user2
Add Interaction with User

for (i = 0; i < argv.length; i++)

{

System.out.println

( " Parm #"

+ i

+ ": --->"

+ argv[i]

+ "<---" );

}

System.out.println ("");

}

}

CS423 (cotter)

add interaction with user3
Add interaction with user

G:\ParmApplication>javac ParmApplication.java

G:\ParmApplication>java ParmApplication

Put parameters on the command line. Here is the syntax:

java ParmApplication Parm0 Parm1 Parm2 [...]

G:\ParmApplication>java ParmApplication first 2nd 35

3 string parameter(s) entered:

Parm #0: --->first<---

Parm #1: --->2nd<---

Parm #2: --->35<---

G:\ParmApplication>

CS423 (cotter)

get input from user
Get Input from User

import java.io.*;

class InputApp

{

InputApp ()

{

DataInputStream dis = new DataInputStream (System.in);

String sIn = " ";

String sOut = " ";

File fIn;

File fOut;

FileInputStream fis;

FileOutputStream fos;

int iNumBytesRead;

byte[] ab;

CS423 (cotter)

get input from user1
Get Input from User

System.out.println

("*-------------------------------------------*");

System.out.print ("Enter Source File Name Here: ");

System.out.flush ();

try {sIn = dis.readLine ();}

catch (Exception e)

{System.out.println ("Exception on input file name"

+ e);}

System.out.print("Enter Destination File Name Here: ");

System.out.flush ();

try {sOut = dis.readLine ();}

catch (Exception e)

{System.out.println ("Exception on output file name"

+ e);}

CS423 (cotter)

get input from user2
Get Input from User

try

{

fIn = new File (sIn);

fis = new FileInputStream (fIn);

fOut = new File (sOut);

fos = new FileOutputStream (fOut);

ab = new byte[2048];

while ((iNumBytesRead = fis.read (ab)) != -1)

{ fos.write (ab, 0, iNumBytesRead); }

fis.close ();

fos.close ();

}

catch (Exception e)

{System.out.println ("Exception during copy: " + e); }

CS423 (cotter)

get input from user3
Get Input from User

System.out.println ("Data copied from " + sIn + " to "

+ sOut);

System.out.println

("*-------------------------------------------*");

}

public static void main (String args[])

{

new InputApp ();

}

}

CS423 (cotter)

get input from user4
Get Input from User

G:\Data\Java\InputApp>java InputApp

*-------------------------------------------*

Enter Source File Name Here: books_db.txt

Enter Destination File Name Here: My_list.txt

Data copied from books_db.txt to My_list.txt

*-------------------------------------------*

G:\Data\Java\InputApp>

CS423 (cotter)

java inheritance extension awt
Java Inheritance (extension)- awt
  • Object - “cosmic base class”
  • Component - button, listBox
  • Container - dialog box
  • Panel - “sub-window”, group of buttons, etc.
  • Applet - small application, web enabled
  • MyApplet - specific instance of an applet

CS423 (cotter)