WebDeveloper.com ®: Where Web Developers and Designers Learn How to Build Web Sites, Program in Java and JavaScript, and More!   
Web Developer Resource DirectoryWebDev Jobs  
Animated GIFs
CSS
CSS Properties
Database
Design
Flash
HTML
HTML 4.01 Tags
JavaScript
.NET
PHP
Reference
Security
Site Management
Video
XML/RSS
WD Forums
 Client-Side
  Development

    CSS
    Graphics
    HTML
    JavaScript
    XML
    Dreamweaver/FrontPage
    Multimedia
    Web Video
    General
    Accessibility

 Server-Side
  Development

    ASP
    Perl
    PHP
    .NET
    Java
    SQL
    Other

 Web Development
  Business Issues

    Business Matters
    Website Reviews

 E-Commerce
    Domain Names
    Search Engines

 Etc.
    Computer Issues
    Forum Software
    Feedback
    The Coffee Lounge



Script Downloads
Number Formatting

Featured: May 12, 2008
Description: These two functions clean up and format numbers quite nicely. One function takes any decimal number, negative or positive, and formats it by adding commas every three digits. The other function strips any non-numeric characters from a string leaving you with a valid decimal number. It considers the minus sign and the period to be numeric and will not strip them unless the minus sign is not at the beginning of the number or there is more than one period. These functions make use of regular expressions to do the heavy lifting.

Get Script

Hosting Search
Unix   Windows
PHP   Webmail

Sign up for the free WebDeveloper E-mail newsletter!


JupiterWeb Commerce
Partners & Affiliates
Partner With Us
Promotional Products
Imprinted Promotions
Promotional Golf
Laptop Batteries
Compare Prices
Computer Hardware
Web Hosting Directory
KVM Switches
Condos For Sale
Phone Cards
Online Shopping
KVM Switch over IP
Data Center Solutions
Corporate Gifts

internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

Java Programming ... From the Grounds Up
Part 4

by Mark C. Reynolds

Packaging up your code

Advanced Java Classes

The collection of Java classes is structured as a tree, in which each node has exactly one parent. Since Java classes can only inherit from one class at a time, it is said to support a single-class inheritance hierarchy.

FIGURE 2
Important components of the Java hierarchy.

java.lang
   Boolean	Character	Integer
   Long		Float		Double
   String	Class		Math
   Number	Object		Process
   System	Thread

java.awt
   Button	Canvas		Checkbox
   Choice	Color		Dimension
   Event	FileDialog	Font
   Graphics	Image		Insets
   Label	List		Menu
   MenuBar	MenuItem	Panel
   Point	Polygon		Rectangle
   Scrollbar	TextArea	TextField
   Window

java.io
   DataInput	    DataInputStream      InputStream
   DataOutput	    DataOutputStream     OutputStream
   File		    FileInputStream      FileOutputStream
   FilenameFilter   FilterInputStream    FilterOutputStream
   PrintStream	    RandomAccessFile     StreamTokenizer

java.net
   ContentHandler  InetAddress		ServerSocket
   URL		   URLConnection	URLStreamHandler

java.applet
   Applet          AudioClip

java.util
   BitSet	Date 		Dictionary
   Enumeration	Hashtable	Properties
   Random	Stack		StringTokenizer
   Vector

The top of the Java class hierarchy is organized into a set of related classes, called packages. The main Java packages are java.lang, java.net, java.io, java.awt, java.util, and java.applet. The java.lang package implements the basic components of the Java language, including string manipulation, mathematical functions, and conversion operations such as the simple string-to-integer one seen in Primes.java. The java.net package contains the network access functions, including those associated with opening a URL and getting its contents. The java.io package handles all kinds of input and output, implementing various forms of streaming (much like stdin and stdout in C or cin and cout in C++). Graphics are handled by java.awt. "AWT" is said to stand for "Another Window Toolkit" or "Advanced Window Toolkit," depending on who you ask. The AWT implements standard graphic components such as menus, panels, buttons, and checkboxes. The AWT also implements a number of sophisticated image manipulation functions within the java.awt.image subpackage. If you have ever programmed Windows or Macintosh graphics, used X or a higher level toolkit such as Tk, then AWT will seem very familiar. The java.util package has additional utility functions for string, vector and stack manipulation, hashing, date conversion, and a number of other goodies. Finally, java.applet is a very special package that actually creates a subclass of Applet whenever a new applet is produced.

[ < Java Programming ... From the Grounds Up:
Part 3 ]
[ Java Programming ... From the Grounds Up:
Part 5 > ]




Acceptable Use Policy

JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers