Java Programming Tutorials

Java Programming Tutorials And Articles
  Title / Author Reverse Sort Order Replies
Using Regular Expressions in Java JDK versions 1.4.0 and later have comprehensive support for regular expressions through the standard java.util.regex package. Because Java lacked a regex package for so long, there are also many 3rd party regex packages available for Java. I will only discuss...
An Applet is a small program that can be sent across the Internet and interpreted on a client machine. To give permission for remote access it must be a public class. Typically it is a class that inherits and/or defines a special set of functions needed to run an applet. These are part of the class...
A thread, by definition is a light weight process. They are used to increase functionality and performance by performing multiple tasks at the same time, i.e. concurrently. There are two methods for implementing threads in Java, Implementing an interface Extending a class I'd assume that...
Java has a class called File, which actually represents not a file you can read or write, but rather a filename. Using this class is highly recommended instead of simple strings, because it makes your file naming operating-system independent. You can easily find out wether a filename is relative or...
When many items of data of the same class or type have to be stored, it is more efficient to use an array than separate variables or objects. For example, if the temperature on each day of the (non-leap) year had to be stored, rather than set up tempjan1, tempjan2... tempdec31 (365 variables)...
Multi-dimensional arrays Java, as with most languages, supports multi-dimensional arrays - 1-dimensional, 2-dimensional, 3-dimensional, ... This discusses 2-dimensional arrays, but the same principles apply to higher dimensions. 2-dimensional arrays 2-dimensional arrays are usually...
Automatic Conversion In Java type conversions are performed automatically when the type of the expression on the right hand side of an assignment operation can be safely promoted to the type of the variable on the left hand side of the assignment. Thus we can safely assign: byte -> short -> int...
Introduction A pattern of special characters is used to specify the format of the date. The example below demonstrates some of the characters. For a complete listing, see the javadoc documentation for the SimpleDateFormat class. Note: This example formats dates using the default locale...
The Decimal Format class is not very well documented, so I will try and exmplain it with an example. Firstly, you need to import the DecimalFormat class: import java.text.DecimalFormat; Create an instance the format object. This object can be used with doubles, as it uses a decimal. It uses a...
Here is a simple implementation of client-server using Java. There are two java files, one for client code and one for server code. The code is quite self-explanatory. /* ** A TCP based client that will send the number entered by the user for factorial ** ...
Objects in Java are referred using reference types, and there is no direct way to copy the contents of an object into a new object. The assignment of one reference to another merely creates another reference to the same object. Therefore, a special clone() method exists for all reference...
Java's networking classes enable you to implement applications that communicate across a network/remote connection, but the platform also extends into the realm of the Internet and URLs. Java's URL class makes accessing Web resources as easy as accessing a local file. Let's take a look at how you...
Growing an Array in Java Suppose you have an array of some type that is full, and you want to grow it. Employee a = new Employee; // array is full int newLength = a.length * 11 / 10 + 10; Employee newArray = new Employee; System.arraycopy(a, 0, newArray, 0, a.length); a = newArray;That...
Introduction Assertion facility is added in J2SE 1.4. In order to support this facility J2SE 1.4 added the keyword assert to the language, and AssertionError class. An assertion checks a boolean-typed expression that must be true during program runtime execution. The assertion facility can be...
Introduction Handling character strings in Java is supported through two final classes: String and StringBuffer. The String class implements immutable character strings, which are read-only once the string has been created and initialized, whereas the StringBuffer class implements dynamic...
What Is GlassFish? Depending on how you look at it, GlassFish is any of the following: A community. The GlassFish community currently includes over 1100 members participating in the GlassFish project, with the objective of developing an open source application server that implements Java EE...
Here is a file splitter made in java . try it with files. Don't try it with directory. It will not respond in the way u want. Splitter class import*; class Splitter { public static void main(String args) throws IOException { takeInput(args);
Java program for zipping.Download the file given as attachment. unzip the file and store it in any folder in ur hard-drive.... go to command prompt.... set the classpath properly. C:\Zipper\ C:\Zipper>set classpath=. then type
Introduction The solution is mainly used in Error website wherein you have to generate reports which gives the number of solutions uploaded in a specific period(Reports by calendar) or the number of solutions posted by particular employee (reports by employee id). Background My...
Introduction This component is suitable to convert a well-formed html with/without inline CSS to a PDF file. HTML to PDF Converter is a tool to convert HTML to PDF. HTML to PDF Converter accurately transforms well-formed HTML with or without inline cascading style sheets into PDF...