Java

Java, J2EE, J2SE, Object Oriented Programming

Java Multi-threading, Synchronization

by: Matt Hofstetter | April 18 , 2011 | views: 987

This example demonstrates a multi-threaded program that must share a resource between threads. Each thread will be required to obtain an exclusive lock on the shared resource to avoid a potentially disastrous conflict. We will create two threads, one called MissileFactory and one called MissileLauncher. The… view article

Java: Serialization, Number, Date and Currency Formatting

by: Matt Hofstetter | April 11 , 2011 | views: 163

The following class demonstrates the use of Java's Format, Number, Date and Locale classes (util.*, text.*). It also shows how to serialize and de-serialize and object by implementing the Serializable interface (io.*). Item.java //Demonstrates: //Serialization, //Number/Currency Formatting,… view article

Java: Pattern, Matcher and Regex

by: Matt Hofstetter | April 11 , 2011 | views: 166

The following class demonstrates basic use of Java's Pattern and Matcher class by adding the rel attribute 'nofollow' to the anchor tags of several links. *Note, this is for educational purposes only. Pattern, Matcher and Regex are NOT ideal for manipulating HTML in Java. NoFollow.java //Adds… view article

Connect to Database with JDBC, Singleton

by: Matt Hofstetter | April 5 , 2011 | views: 837

This example shows how to connect to, and query, a MySQL database in Java using JDBC. The example will attempt to implement the singleton design pattern. The singleton design pattern restricts the instantiation of a class to one object. First get a copy of the MySQL JDBC driver at: http://www.mysql.com/downloads/connector/j/ Extract… view article

Parsing XML with Java

by: Matt Hofstetter | March 11 , 2011 | views: 414

This tutorial shows how to retrieve an XML document from a URL and parse it using Java's SaxParser. The XML in question comes from a zekkocho exclusive API that returns a random set of Japanese words along with their possible Engilsh definitions. http://www.zekkocho.com/api/japanese/wordset.php?n=5 − 効力 こうりょく effect efficacy validity potency ... Before… view article