category

home / developersection / category

Java I/O: Input/Output Streams
java 24-May-2016
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.

Exception Handling in Java: The throw Statement
java 23-May-2016
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
java 23-May-2016
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
java 23-May-2016
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.

Exception Handling in Java: Declaring Exceptions in Overriding Methods
java 21-May-2016
Exception Handling in Java: Declaring Exceptions in Overriding Methods

Let’s recall the rules we learn from previous post about declaring exception in Overriding Methods.

Class Concepts in Java: Class Instantiation and Accessing Fields
java 21-May-2016
Class Concepts in Java: Class Instantiation and Accessing Fields

A class definition serves as a template from which we create objects for the use of our application code

Class Concepts in Java: Declaring Constructors
java 21-May-2016
Class Concepts in Java: Declaring Constructors

A constructor is a special method that the runtime executes during the object-creation process. In previous parts, we saw that the following statement calls the class constructor:

Exception Handling in Java: Classifying Exceptions
java 20-May-2016
Exception Handling in Java: Classifying Exceptions

At the top of the Exception class hierarchy we have the Throwable class. All other exception classes, including our own designed exception classes, inherit from the Throwable class.

Exception Handling in Java: Guidelines on the use of finally block
java 20-May-2016
Exception Handling in Java: Guidelines on the use of finally block

We may have a finally block in conjunction with a try block without a catch block. In other words

Exception Handling in Java: Multiple Exception Handlers
java 20-May-2016
Exception Handling in Java: Multiple Exception Handlers

Let’s now look at an example where the running code generates multiple types of exceptions.

Nested Classes in Java: More with Inner Classes
java 19-May-2016
Nested Classes in Java: More with Inner Classes

If an inner class is declared with a public access modifier, it can be instantiated from outside the scope of its enclosing class.

Nested Classes in Java: Classifications of Nested Classes
java 19-May-2016
Nested Classes in Java: Classifications of Nested Classes

To create a static nested class, we use the static keyword in front of the class declaration, the same way we declare a static field or a method within the enclosing class.