Home » Java Basics » Page 3

Java Basics

java.lang.InterruptedException – How to handle InterruptedException

Bipartite Graph

In this example we will discuss about InterruptedException in Java. This exception is thrown when a thread is interrupted. The thread could be in either waiting, sleeping or running state and this exception can be thrown either before or during a thread’s activity. This exception extends the Exception class and thus, can be classified as a checked exception. Checked exceptions ...

Read More »

java.lang.UnsupportedOperationException – How to handle UnsupportedOperationException

Bipartite Graph

In this tutorial we will discuss about UnsupportedOperationException in Java. This exception is thrown to indicate that the requested operation is not supported. This exception extends the RuntimeException class and thus, belongs to those exceptions that can be thrown during the operation of the Java Virtual Machine (JVM). It is an unchecked exception and thus, it does not need to ...

Read More »

Java 8 Lambda Expressions Tutorial

Bipartite Graph

In this article we are going to explain what Lambdas are, why are they important and how do they look like in Java. We are going to see also a couple of examples and real life applications. All examples are being implemented using Eclipse Luna version 4.4 and Java version 8 update 5. Lambdas? A Lambda, in general, is a ...

Read More »

java.util.NoSuchElementException – How to solve NoSuchElementException

Bipartite Graph

In this tutorial, we will discuss about the java.util.nosuchelementexception in Java. This exception is thrown to indicate that there are no more elements in an enumeration. This exception extends the RuntimeException class and thus belongs to those exceptions that can be thrown during the operation of the Java Virtual Machine (JVM). It is an unchecked exception and thus, it does ...

Read More »

java.io.NotSerializableException – How to solve Not Serializable Exception

Bipartite Graph

In this tutorial we will discuss about NotSerializableException in Java. The exception is thrown when an instance of a class must implement the Serializable interface. The exception is thrown by either the serialization runtime, or by the instance of the class. The argument of the NotSerializableException is the name of the class. The NotSerializableException class extends the ObjectStreamException class, which ...

Read More »

Java String to Date Example

Bipartite Graph

Java gives us the capability to convert String to Date. This can be done through DateFormat and SimpleDateFormat classes, where the last class is a subclass of the first one. It is worth to mention that DateFormat is not thread-safe, so it is recommended to create different instances for each thread. In this example we will show you how to ...

Read More »

Java String to char Example

Bipartite Graph

String to char conversion is a very simple procedure in Java. This process is useful when we want to use char format instead of strings in our applications, for instance in the arguments in command line. In this example we are going to show you how to parse a String to character(s). 1. Example of String to char conversion Create ...

Read More »

Java String to Float Example

Bipartite Graph

float is a frequently used data type of 32-bit and it represents decimal numbers. The main difference from double is that it requires smaller size in memory but in some situations (big numbers) doesn’t represent the accurate number. A commonly used procedure in Java is the convertion from string to float. In this example we shall show you all the ...

Read More »