Home > DeveloperSection > Articles

Latest Articles – MindStick

Autoboxing and Unboxing in Java

In the previous posts, we have just seen the use of type wrappers in wrapping the primitive data types. Beginning in J2SE 5.0, we will not have to explicitly perform such wrapping. The wrapping/unwrapping is now implicit and automatic.

 Java Java 
By zack mathews posted   yesterday

Wrapper Classes: A Few Additions in J2SE 5.0 (Part-2)

The Character class that wraps a char data type provides several utility methods to operate on character data. We can test whether the given character is a digit, a letter, a lowercase character, and so on. The simple program given here illustrates t

 Java Java 
By zack mathews posted   yesterday

Wrapper Classes: A Few Additions in J2SE 5.0 (Part-1)

The type wrapper classes were provided in Java libraries since its first release. J2SE 5.0 made several useful additions to its methods. For example, the Integer class now provides methods for bit manipulations.

 Java Java 
By zack mathews posted   2 days ago

Wrapper Classes: Constructors and Methods

To wrap a primitive type into one of these classes, we use the provided class constructor. Generally, each of these classes provides two constructors:

 Java Java 
By zack mathews posted   2 days ago

Java Enumerations: Serializing enum Types

Earlier we learned that objects of the enum type can be serialized and compared to each other.

 Java Java 
By Simond Gear posted   3 days ago

Java Enumerations: Attaching Methods to Enumerations

Suppose we want to convert a user-specified weight in pounds to a different unit of measure, such as kilograms, carats, or ounces.

 Java Java 
By Simond Gear posted   3 days ago

Java Enumerations: Adding Properties to an Enumeration

To add a property to an enumeration constant, we would need to define its constructor.

 Java Java 
By Simond Gear posted   3 days ago

Java Enumerations: Days of the Week Example

In the previous post, we have seen why we need Enums in java, we have seen how to create integer patterns for Enumerations.

 Java Java 
By Simond Gear posted   3 days ago

Java Enumerations: Why we need Enums?

Oftentimes, we need a fixed set of constants in our application. Examples might include the days of the week and the colors in a rainbow.

 Java Java 
By Simond Gear posted   3 days ago

Java I/O: Versioning Objects

We have covered how to persist the object state to a disk file. In many situations, the classes in a program evolve over time.


Java I/O: Nested Objects Serialization

A Serializable object may contain references to other objects. We may be wondering if we serialize an object, whether the nested objects are also serialized.

 Java Java 

Java I/O: Understanding Externalizable Interface with Example

A program that illustrates the use of the Externalizable interface is given here. Note that the program uses Java’s security API. We need not worry about the security code while learning the importance of the Externalizable interface.


Java I/O: The Object-Oriented Streams- Externalizable Interface

In the previous posts, we saw how to store and retrieve the objects using Serialization. We’ll now look at another very important technique for storing and retrieving objects.


Java I/O: The StreamTokenizer Class

The StreamTokenizer is another very useful class that parses an input stream into tokens. This class is not derived from InputStream or OutputStream. Yet, it is classified under the I/O library.


Java I/O: The Console Class

So far we have been using System.out to print messages to the console. Java SE 6 added a Console class to enhance and simplify command-line applications.


Java I/O: The PrintStream Class and Character-Oriented Stream Classes

This is a very convenient class that has the ability to print representations of various data values, such as all primitive types. During printing it converts all characters into bytes using the platform’s default character encoding.


Java I/O: Binary versus Character and Chaining Streams

If we are working with binary data such as images and sounds, we need to use binary mode files.

 Java Java 
By zack mathews posted   4 days ago

Java I/O: The OutputStream Methods

Similar to the InputStream class, the abstract OutputStream class is a superclass of all classes representing an output stream of bytes. A few examples of these subclasses are:

 Java Java 
By David Miller posted   5 days ago

Java I/O: File Copy Utility

The File Copy program accepts two command-line parameters and copies the contents of the file specified by the first parameter to the filename specified in the second parameter.

 Java Java 
By David Miller posted   5 days ago

Java I/O: The InputStream Methods

The read method we used in the previous post is in fact defined in the InputStream class. The FileInputStream class that extends from the InputStream class inherits this method.

 Java Java 
By David Miller posted   5 days ago

Java I/O: The I/O Class Hierarchy

Java provides a rich set of classes for I/O. A high-level class diagram for the I/O class library is shown here:

 Java Java 
By David Miller posted   5 days ago

Java I/O: Input/Output Streams

One of the important set of classes comprised in Java API is the java.io package. This is one of the core packages of the Java language and was a part of JDK 1.0. These classes facilitate the input/output functionality in our programs.

By David Miller posted   5 days ago

Exception Handling in Java: The throw Statement

As seen in the previous post, we need to construct an instance of a user-defined exception; the Java runtime cannot detect and create instances of user-defined exceptions.


Exception Handling in Java: User-defined Exceptions

Sometimes we may find that the exception messages given by the standard exception classes are not intuitive, and it may be necessary to provide more elaborate messages to the application user.


Exception Handling in Java: final Re-throw and Exceptions in Overriding Methods

The throw keyword (note the singular form) is used to force an exception.


Don't want to miss updates? Please click the below button!

Follow MindStick