Top Banner
UMBC CMSC 331 Java The JAVA The JAVA API API
48

UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

Dec 24, 2015

Download

Documents

Brice Dickerson
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

UMBC CMSC 331 Java

The JAVA The JAVA APIAPI

Page 2: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

2UMBC CMSC 331 Java

A Tour of the Java API

• An API User’s Guide, in HTML, is bundled with Java

• Much of the “learning curve” is in the API• Let’s look at some packages

Page 3: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

3UMBC CMSC 331 Java

The Java API

• java.applet– Applet class

• java.awt– Windows, buttons, mouse,

etc.

• java.awt.image– image processing

• java.awt.peer– GUI toolkit

• java.io– System.out.print

• java.lang– length method for arrays;

exceptions

• java.net– sockets

• java.util– System.getProperty

See http://java.sun.com/j2se/1.3/docs/api/for the current APIs

Page 4: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

4UMBC CMSC 331 Java

Page 5: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

5UMBC CMSC 331 Java

Page 6: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

6UMBC CMSC 331 Java

Page 7: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

7UMBC CMSC 331 Java

The package java.lang

• The class Object– The root class in Java

– Example methods: clone(), equals(), toString()

– Subclasses may override these methods

• The class Class– Example methods: getName(), getSuperClass()

Page 8: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

8UMBC CMSC 331 Java

Observing an object’s class

void printClassName (Object obj) { System.out.println("The class of " + obj + " is " + obj.getClass().getName());}

Page 9: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

9UMBC CMSC 331 Java

Strings in Java• Strings are nt a primitive data type, but represented

as objects.• Many methods defined in class java.lang:

– Several constructors– Lots of methods: concat(), equals(), indexOf(), length()– strings are concatenated with +

• Strings are constants (immutable) – You can concatenate two strings to produce a new,

longer string, using the + operator, but you cannot add, delete, insert into, or delete from any particular string.

Page 10: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

10UMBC CMSC 331 Java

StringBuffers in Java

• Several methods defined in class java.lang:– Constructors can specify length or initial value– append(), insertf(), length(), toString()

Page 11: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

11UMBC CMSC 331 Java

Java.lang.system

• Printstreams– System.out.err(“Error message”);

• Inputstreams– System.in.read(inputCharacter)

– System.in.read(inputBuffer, 0, maxChars)

Page 12: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

12UMBC CMSC 331 Java

The Cloneable Interface

• A class implements the cloneable interface by overriding the Object method clone()

• For example, we could add a clone() method to the FIFO class, if we wanted to be able to make copies of queues.

Page 13: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

13UMBC CMSC 331 Java

The class java.util

• Interface to host OS• Some basic functions and data structures

– BitSet, Dictionary (the superclass of Hashtable), Stack, Vector

– Random number generation

Page 14: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

14UMBC CMSC 331 Java

System Properties

• System properties are like UNIX environment variables, but platform independent

• The API class java.util has methods for accessing the system properties

Page 15: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

// determine environment variablesimport java.util.*;class envSnoop { public static void main ( String args[] ) { Properties p; String s; p = System.getProperties(); p.list(System.out); s = System.getProperty("user.name"); System.out.println("user.name="+s); s = System.getProperty("user.home"); System.out.println("user.home="+s); }}

Page 16: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

C:\UMBC\331\java>java envSnoop

-- listing properties --

java.specification.name=Java Platform API Specification

awt.toolkit=sun.awt.windows.WToolkit

java.version=1.2

java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment

user.timezone=America/New_York

java.specification.version=1.2

java.vm.vendor=Sun Microsystems Inc.

user.home=C:\WINDOWS

java.vm.specification.version=1.0

os.arch=x86

java.awt.fonts=

java.vendor.url=http://java.sun.com/

user.region=US

file.encoding.pkg=sun.io

java.home=C:\JDK1.2\JRE

java.class.path=C:\Program Files\PhotoDeluxe 2.0\Adob...

line.separator=

java.ext.dirs=C:\JDK1.2\JRE\lib\ext

java.io.tmpdir=C:\WINDOWS\TEMP\

os.name=Windows 95

java.vendor=Sun Microsystems Inc.

java.awt.printerjob=sun.awt.windows.WPrinterJob

java.library.path=C:\JDK1.2\BIN;.;C:\WINDOWS\SYSTEM;C:\...

java.vm.specification.vendor=Sun Microsystems Inc.

sun.io.unicode.encoding=UnicodeLittle

file.encoding=Cp1252

java.specification.vendor=Sun Microsystems Inc.

user.language=en

user.name=nicholas

java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport...

java.vm.name=Classic VM

java.class.version=46.0

java.vm.specification.name=Java Virtual Machine Specification

sun.boot.library.path=C:\JDK1.2\JRE\bin

os.version=4.10

java.vm.version=1.2

java.vm.info=build JDK-1.2-V, native threads, symcjit

java.compiler=symcjit

path.separator=;

file.separator=\

user.dir=C:\UMBC\331\java

sun.boot.class.path=C:\JDK1.2\JRE\lib\rt.jar;C:\JDK1.2\JR...

user.name=nicholas

user.home=C:\WINDOWS

C:\UMBC\331\java>

Page 17: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

17UMBC CMSC 331 Java

Java GUI

• The awt class allows you to create– frames

– buttons

– menus and menubars

– checkboxes

– text areas

– scrolling lists

Page 18: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

18UMBC CMSC 331 Java

GUI Examples

• “Hello World”, revisited• The Scribble example• Both examples adapted from Flanagan’s “Java in a

Nutshell”, first edition

Page 19: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

import java.applet.*;import java.awt.*;

public class SecondApplet extends Applet { static final String message = "Hello World"; private Font font;

// One-time initialization for the applet public void init() { font = new Font("Helvetica", Font.BOLD, 48); }

// Draw the applet whenever necessary. // Do some fancy graphics. public void paint(Graphics g) { // The pink oval g.setColor(Color.pink); g.fillOval(10, 10, 330, 100);

Page 20: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

// The red outline. java doesn't support wide lines, so we// try to simulate a 4-pixel wide line by drawing four ovals g.setColor(Color.red); g.drawOval(10,10, 330, 100); g.drawOval(9, 9, 332, 102); g.drawOval(8, 8, 334, 104); g.drawOval(7, 7, 336, 106);

// The text g.setColor(Color.black); g.setFont(font); g.drawString(message, 40, 75); }}

Page 21: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

21UMBC CMSC 331 Java

Scribble

• Graphics objects can be added to applets, e.g. buttons and menus

• Events, such as mouse clicks, are handled

Page 22: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

import java.applet.*;import java.awt.*;

public class Scribble extends Applet { private int last_x = 0; private int last_y = 0; private Color current_color = Color.black; private Button clear_button; private Choice color_choices; // Called to initialize the applet. public void init() {

// Set the background colorthis.setBackground(Color.white);

// Create a button and add it to the applet.// Also, set the button's colorsclear_button = new Button("Clear");clear_button.setForeground(Color.black);clear_button.setBackground(Color.lightGray);this.add(clear_button);

Page 23: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

// Create a menu of colors and add it to the applet.// Also set the menu's colors and add a label.color_choices = new Choice();color_choices.addItem("black");color_choices.addItem("red");color_choices.addItem("yellow");color_choices.setForeground(Color.black);color_choices.setBackground(Color.lightGray);this.add(new Label("Color:"));this.add(color_choices);

}

Page 24: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

// Called when the user clicks the mouse to start a scribble public boolean mouseDown(Event e, int x, int y) { last_x = x; last_y = y; return true; }

// Called when the user scribbles with the mouse button down public boolean mouseDrag(Event e, int x, int y) { Graphics g = this.getGraphics(); g.setColor(current_color); g.drawLine(last_x, last_y, x, y); last_x = x; last_y = y; return true; }

Page 25: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

// Called when the user clicks the button or chooses a color public boolean action(Event event, Object arg) { // If the Clear button was clicked, handle it if (event.target == clear_button) { Graphics g = this.getGraphics(); Rectangle r = this.bounds(); g.setColor(this.getBackground()); g.fillRect(r.x, r.y, r.width, r.height); return true;

} // Otherwise if a color was chosen, handle that

if (event.target == color_choices) { if (arg.equals("black")) current_color=Color.black; else if (arg.equals("red")) current_color=Color.red; else if (arg.equals("yellow")) current_color=Color.yellow; return true;}

// Otherwise let the superclass handle the event else return super.action(event, arg); }}

Page 26: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

26UMBC CMSC 331 Java

Java.net

• Defines several useful objects:– URLs

– Internet Addresses

– Sockets

– Datagrams• packets

• sockets

Page 27: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

27UMBC CMSC 331 Java

Manipulating URLs

• A Web server can provide lots of information about a file being sent back in response to an HTTP request.

• A URL can be read– into a string, using the getContent()

– or opened as a DataInputStream, and read using readLine()

Page 28: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

import java.net.*;import java.io.*;import java.util.*;

public class GetURLInfo {

// Create a URL from the specified address, open a connection // to it, and then display information about the URL. public static void main(String[] args) throws MalformedURLException, IOException { URL url = new URL(args[0]); URLConnection connection = url.openConnection(); printinfo(connection); }

Page 29: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

public static void printinfo(URLConnection u) throws IOException { // Display the URL address, and information about it. System.out.println(u.getURL().toExternalForm() + ":"); System.out.println(" Content Type: " + u.getContentType()); System.out.println(" Content Length: " + u.getContentLength()); System.out.println(" Last Modified: " + new Date(u.getLastModified())); System.out.println(" Expiration: " + u.getExpiration()); System.out.println(" Content Encoding: " + u.getContentEncoding()); // Read and print out the first five lines of the URL. System.out.println("First five lines:"); DataInputStream in = new DataInputStream(u.getInputStream()); for(int i = 0; i < 5; i++) { String line = in.readLine(); if (line == null) break; System.out.println(" " + line); } }}

Page 30: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

30UMBC CMSC 331 Java

UDP Examples

• UDP - Unreliable datagram packet• Examples from Flanagan

– Send a UDP packet

– Receive a UDP packet

Page 31: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

// This example is from the book _Java in a Nutshell_ by // David Flanagan.// Written by David Flanagan. // Copyright (c) 1996 O'Reilly & Associates.// You may study, use, modify, and distribute this example for // any purpose. This example is provided WITHOUT WARRANTY // either expressed or implied.

import java.io.*;import java.net.*;

// This class sends the specified text as a datagram to// port 6010 of the specified host.public class UDPSend { static final int port = 6010; public static void main(String args[]) throws Exception { if (args.length != 2) { System.out.println( "Usage: java UDPSend <hostname> <message>"); System.exit(0); }

Page 32: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

// Get the internet address of the specified host InetAddress address = InetAddress.getByName(args[0]); // Convert the message to an array of bytes int msglen = args[1].length(); byte[] message = new byte[msglen]; args[1].getBytes(0, msglen, message, 0);

// Initilize the packet with data and address DatagramPacket packet = new DatagramPacket(message, msglen, address, port); // Create a socket, and send the packet through it. DatagramSocket socket = new DatagramSocket(); socket.send(packet); }}

Page 33: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

import java.io.*;import java.net.*;

// This program waits to receive datagrams sent to port 6010. // When it receives one, it displays the sending host and port, // and prints the contents of the datagram as a string.public class UDPReceive { static final int port = 6010; public static void main(String args[]) throws Exception { byte[] buffer = new byte[1024]; String s; // Create a packet with an empty buffer to receive data DatagramPacket packet = new DatagramPacket(buffer, buffer.length); // Create a socket to listen on the port. DatagramSocket socket = new DatagramSocket(port);

Page 34: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

for(;;) { // Wait to receive a datagram socket.receive(packet); // Convert the contents to a string s = new String(buffer, 0, 0, packet.getLength()); // And display them System.out.println("UDPReceive: received from " + packet.getAddress().getHostName() + ":" + packet.getPort() + ": " + s); } // close for } // close main} // close class UDPReceive

Page 35: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

35UMBC CMSC 331 Java

Using Threads

• Thread objects are the basis for multi-threaded programming.

• Multi-threaded programming allows a single program to conduct concurrently running threads that perform different tasks.

• Defined in java.lang.Thread

Page 36: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

36UMBC CMSC 331 Java

The Runnable Interface

• A class that implements this interface can provide the “body” of a thread

• The run() method needs to be specified

Page 37: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

37UMBC CMSC 331 Java

Using a Single Thread

• The simpleThread class implements the Runnable interface– Implements run() method for Runnable interface

– Implements init(), start() and stop(), extending Applet class

– Can’t just extend Thread class, since Thread.stop() is final and can’t be overriden (why?)

Page 38: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

// Simple Thread Example, based on "Neon Sign"

public class OneThread extends java.applet.Applet implements Runnable { Thread kicker;

public void init() { kicker = null; } public void start() { if(kicker == null) { // If no thread is started yet kicker=new Thread(this); // then create one kicker.start(); // and start it } }

public void stop() { kicker.stop(); kicker = null; }

Page 39: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

public void run() { long sleepTime; System.out.println("Hello!"); sleepTime = 5000;

while(true) { // Loop forever // The sleep method below might be interrupted // and cause an exception, so catch it. try { // Wait for some period of time Thread.sleep( sleepTime ); sleepTime = (sleepTime == 3000 ? 4000 : 3000 ); } catch (Exception e){ return; } System.out.println("Hello again after "+sleepTime+ " milliseconds"); } }}

Page 40: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

40UMBC CMSC 331 Java

Neon Sign Example

• Start a thread• Load two GIF images• Repeat forever

– Display first image

– Sleep a random period of time

– Display the other image

Page 41: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

// Blinking Neon Light by Mattias Flodin

import java.awt.*;

public class BlinkItem extends java.applet.Applet implements Runnable { Image imPic[]; // Array that holds the two images int iPicIndex=0; // Keeps track of which image is displayed Thread kicker;

public void init() { // *Always* resize, in case the HTML author forgot to // include WIDTH and HEIGHT tags resize(512,243); }

public void Paint(Graphics g) { update(g); }

// Using the update method will get rid of some flickering public void update(Graphics g) { // Display an error message if something // unexpected has happened to the images if(imPic[iPicIndex]==null) g.drawString("Error when loading picture", 0, 172);

// Draw the current image g.drawImage(imPic[iPicIndex],0,0, this); }

Page 42: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

public void start() { if(kicker == null) { // If no thread is started yet kicker=new Thread(this); // then create one kicker.start(); // and start it } } public void stop() { kicker=null; } public void run() { imPic=new Image[2]; // Dimension the image array // Load the two images in our 'animation' imPic[0]=getImage(getCodeBase(), "images/Homepage1.gif"); imPic[1]=getImage(getCodeBase(), "images/Homepage2.gif");

for(;;) { // Loop forever repaint(); // Redraw the window iPicIndex=iPicIndex==0 ? 1 : 0; // Switch image // The sleep method below might be interrupted // and cause an InterruptedException, so we'll // have to catch it. try { // Wait for a random amount of time Thread.sleep( (int) (Math.random()*500)); } catch (InterruptedException e){} } }}

Page 43: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

43UMBC CMSC 331 Java

Multiple Threads

• An applet that creates a pool of simple threads• Each thread has an ID number, and may handle

different tasks• Note separation of applet and thread classes

Page 44: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

44UMBC CMSC 331 Java

public class ThreadExample extends java.applet.Applet {

public void init() { simpleThread[] threadPool = new simpleThread[2]; threadPool[0] = new simpleThread(1); threadPool[1] = new simpleThread(2); }}

Multiple Threaded Example

Page 45: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

public class simpleThread implements Runnable {

Thread thisThread; int thisThreadID; public simpleThread (int i) { thisThreadID = i; this.start(); } public void start() { if(thisThread == null) { // If thread isn’t started thisThread = new Thread(this); // create one thisThread.start(); // and start it } }

public void stop() { thisThread.stop(); thisThread = null; }

Page 46: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

public void run() { long sleepTime; System.out.println("Hello from simpleThread "+ thisThreadID); while(true) { // The sleep method below might be interrupted // and cause an exception, so catch it. try { // Wait for a random amount of time sleepTime = (long) ( Math.random()*4 ); Thread.sleep( sleepTime*1000 ); } catch (Exception e) { return; } System.out.println("Hello again from simpleThread "+ thisThreadID+" after "+sleepTime+" seconds"); } } }

Page 47: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

47UMBC CMSC 331 Java

Other Ideas

• Patterns as an addition to the StringBuffer class (ala Perl)

• One could easily write a better browser– intelligent pre-fetching of URLs

– other ideas?

Page 48: UMBC CMSC 331 Java The JAVA API. UMBC CMSC 331 Java 2 A Tour of the Java API An API User’s Guide, in HTML, is bundled with Java Much of the “learning.

48UMBC CMSC 331 Java

Where to get more information

• There are now many decent Java books, e.g. Dietel and Dietel, and the second edition of Flanagan

• Many other web resources