Home » Java Basics » Page 4

Java Basics

Java string to long Example

Long class forms the primitive type long, which can represent an integer number of 32 bits (2^32). A very common procedure in Java programming is the conversion of String to Long. As you can expect, in this example we are going to show how to convert a string to long in every possible way.         1. Syntax ...

Read More »

java.lang.ClassNotFoundException – How to solve Class Not Found Exception (with video)

In this tutorial, we will discuss the java.lang.classnotfoundexception – 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 ...

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 »

String to Double Java Example

In this article, we will show you how to convert string to double in java. String to Double conversion in Java 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 ...

Read More »

Try Catch Java Example

In this example, we will show how to use the try catch Java exception handler. The exception handling in Java is a mechanism to handle runtime errors so that the normal flow of the program can be maintained. An exception is an error that may occur during the execution of a program and denotes that the normal flow of the program should be ...

Read More »

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

In this tutorial, we will discuss how to solve the java.lang.illegalargumentexception – 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 null, the IllegalArgumentException is thrown to indicate that the ...

Read More »

java.io.FileNotFoundException – How to solve File Not Found Exception (with video)

In this tutorial, we will discuss how to solve the java.io.FileNotFoundException – FileNotFoundException in Java. This exception is thrown during a failed attempt to open the file denoted by a specified pathname. Also, this exception can be thrown when an application tries to open a file for writing, but the file is read-only, or the permissions of the file do ...

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 support one dimensional, two dimensional and generally multidimensional arrays. 1. Introduction An array is a container object that holds a fixed number of values of a single type. The length of an array is established when the array is created. Java gives us the opportunity of using arrays with ...

Read More »

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

In this tutorial, we will discuss how to set java.library.path. We will explain 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 ...

Read More »