You are on page 1of 33

Programming in Java

Exploring Java Packages

2011 BlueSignet LLC. All rights reserved.

Check out my Java Package

2011 BlueSignet LLC. All rights reserved.

Packages

Java allows packaging up classes into namespaces These namespaces can be archived into a .jar file Packages can be imported into code and its functionality is absorbed A massive collection of packages forms the class framework that Java is built on

2011 BlueSignet LLC. All rights reserved.

Core Class Concept

All classes in Java inherit from the same parent class

Similar to the NSObject concept in Objective-C

Classes inherit from the Object class which comes from the java.lang package You will see the descriptor Super Class in Java a lot

What is a Super Class?


A class where many other classes derive

2011 BlueSignet LLC. All rights reserved.

java.lang Package

2011 BlueSignet LLC. All rights reserved.

http://download.oracle.com/javase/1.4.2/docs/api/java/lang/package-summary.html

Java Packages

List of packages

http://download.oracle.com/javase/1.4.2/docs/api/package-list

Common packages

java.io java.math java.net java.util java.crypto

2011 BlueSignet LLC. All rights reserved.

java.io

Standard I/O classes Fundamentally manages


file I/O memory buffers network streams

2011 BlueSignet LLC. All rights reserved.

java.io :: Interface Summary

http://download.oracle.com/javase/1.4.2/docs/api/java/io/package-summary.html
2011 BlueSignet LLC. All rights reserved.

java.io :: Class Summary

http://download.oracle.com/javase/1.4.2/docs/api/java/io/package-summary.html
2011 BlueSignet LLC. All rights reserved.

java.io :: Class Summary

http://download.oracle.com/javase/1.4.2/docs/api/java/io/package-summary.html
2011 BlueSignet LLC. All rights reserved.

java.io :: Class Summary

http://download.oracle.com/javase/1.4.2/docs/api/java/io/package-summary.html
2011 BlueSignet LLC. All rights reserved.

java.io :: Class Summary

http://download.oracle.com/javase/1.4.2/docs/api/java/io/package-summary.html
2011 BlueSignet LLC. All rights reserved.

java.io :: Exception Summary

http://download.oracle.com/javase/1.4.2/docs/api/java/io/package-summary.html
2011 BlueSignet LLC. All rights reserved.

java.math

Contains classes that work with massive numbers Numbers that exceed standard integer and double types are handled in a special way in order to maintain its preciseness Very useful in cryptography, where numbers can be extremely large

2011 BlueSignet LLC. All rights reserved.

java.math :: Overview

http://download.oracle.com/javase/6/docs/api/java/math/package-summary.html
2011 BlueSignet LLC. All rights reserved.

java.net

Provides classes for integrating applications with networks

2011 BlueSignet LLC. All rights reserved.

java.net :: Interface Summary

http://download.oracle.com/javase/1.4.2/docs/api/java/net/package-summary.html
2011 BlueSignet LLC. All rights reserved.

java.net :: Class Summary

http://download.oracle.com/javase/1.4.2/docs/api/java/net/package-summary.html
2011 BlueSignet LLC. All rights reserved.

java.net :: Class Summary

http://download.oracle.com/javase/1.4.2/docs/api/java/net/package-summary.html
2011 BlueSignet LLC. All rights reserved.

java.net :: Exception Summary

http://download.oracle.com/javase/1.4.2/docs/api/java/net/package-summary.html
2011 BlueSignet LLC. All rights reserved.

java.util

Contains many miscellaneous, date, collection, and legacy classes

2011 BlueSignet LLC. All rights reserved.

java.util :: Interface Summary

2011 BlueSignet LLC. All rights reserved.

http://download.oracle.com/javase/1.4.2/docs/api/java/util/package-summary.html

java.util :: Class Summary

2011 BlueSignet LLC. All rights reserved.

http://download.oracle.com/javase/1.4.2/docs/api/java/util/package-summary.html

java.util :: Class Summary

2011 BlueSignet LLC. All rights reserved.

http://download.oracle.com/javase/1.4.2/docs/api/java/util/package-summary.html

java.util :: Class Summary

http://download.oracle.com/javase/1.4.2/docs/api/java/util/package-summary.html
2011 BlueSignet LLC. All rights reserved.

java.util :: Exception Summary

http://download.oracle.com/javase/1.4.2/docs/api/java/util/package-summary.html

2011 BlueSignet LLC. All rights reserved.

java.crypto

Contains classes that perform cryptography operations Drastically simplifies implementing encryption and decryption in applications

2011 BlueSignet LLC. All rights reserved.

java.crypto :: Interface Summary

http://download.oracle.com/javase/6/docs/api/javax/crypto/package-summary.html
2011 BlueSignet LLC. All rights reserved.

java.crypto :: Class Summary

2011 BlueSignet LLC. All rights reserved.

http://download.oracle.com/javase/6/docs/api/javax/crypto/package-summary.html

java.crypto :: Exception Summary

http://download.oracle.com/javase/6/docs/api/javax/crypto/package-summary.html
2011 BlueSignet LLC. All rights reserved.

How do you use a package?

Much like we would include an external code file in C/C++, in Java we will import an external package

2011 BlueSignet LLC. All rights reserved.

java.io Example
import java.io.*; class HeyBuddy { public static void main (String[] args) { try { FileWriter fOut = new FileWriter("HeyBuddy.txt"); BufferedWriter buffOut = new BufferedWriter(fOut); buffOut.write("Hey Buddy!\n"); buffOut.close(); } catch (IOException ex) { System.err.println("An exception occured: " + ex.toString()); } } }
2011 BlueSignet LLC. All rights reserved.

The End?
Thank You For Watching!

2011 BlueSignet LLC. All rights reserved.