Home » Java Basics (page 4)

Java Basics

java.lang.ClassNotFoundException – How to solve Class Not Found Exception

In this tutorial we will discuss about ClassNotFoundException. This exception is thrown when an application tries to load a class through its string name, but no definition for the specified class name could be found. A class can be loaded using one of the following methods: The forName method that resides inside the Class class. The findSystemClass method that resides ...

Read More »

java.io.ObjectStreamException – How to solve Object Stream Exception

In this tutorial we will discuss about ObjectStreamException. This exception is defined as the superclass of all exceptions specific to Object Stream classes. The ObjectStreamException is defined as an abstract class and thus, an instance of ObjectStreamException cannot be created. Also, the ObjectStreamException extends the IOException class, which signals that an I/O exception has occurred. There is a number of ...

Read More »

Java String to Double Example

String to Double conversion is a frequent procedure because both data types are commonly used. As you can imagine in this example we are going to show all the possible ways of converting String object to Double object.           1. Syntax of the convert operations First of all, in order to convert a string to double, ...

Read More »

Try-catch Java Example

In this example we will show how to use the try-catch exception handler. An exception is an error which may occur during the execution of a program and denotes that the normal flow of the program should be interrupted. NullPointerException, IOException, ArithmeticException, ArrayIndexOutOfBoundsException, are some among others commonly seen exceptions. Those exceptions can be handled by some block of code ...

Read More »

java.lang.IllegalArgumentException – How to solve Illegal Argument Exception

In this tutorial we will discuss about IllegalArgumentException in Java. This exception is thrown in order to indicate that a method has been passed an illegal or inappropriate argument. For example, if a method requires a non-empty string as a parameter and the input string equals to null, the IllegalArgumentException is thrown to indicate that the input parameter cannot be ...

Read More »

Install Java on Ubuntu tutorial

In this tutorial we will show you how to install the latest version of Java in Ubuntu 12.04 or later. An internet connection is required in order to download the corresponding Java packages. There are different versions of Java that can be installed in Ubuntu. First of all, the OpenJDK project is an open-source implementation of the Java SE Platform. ...

Read More »

2D Array Java Example

In this post, we feature a comprehensive 2D Array Java Example. Java give us the opportunity of using arrays with many dimensions. The most common multi-dimensional arrays that are used in java apps are one-, two- and three-dimensional. In this example we are going to present some ways of creating 2D arrays, which are represented as tables with row and ...

Read More »

java.library.path – What is it and how to use

In this tutorial we will discuss about java.library.path, its definition and how can be used by Java applications. The Java Virtual Machine (JVM) uses the java.library.path property in order to locate native libraries. This property is part of the system environment used by Java, in order to locate and load native libraries used by an application. When a Java application ...

Read More »

java.lang.nosuchmethoderror – How to avoid

In this tutorial we will discuss about Java’s NoSuchMethodError and how to deal with it. The NoSuchMethodError is a sub-class of the LinkageError class and denotes that an application code is trying to call a specified method of a class, either static or instance, and that class has no longer a definition for that method. This error exists since the ...

Read More »