What is the difference between checked and unchecked exceptions in Java?

karthikeya Boyini
Published on 04-Jan-2018 12:12:06
A checked exception is an exception that occurs at the compile time, these are also called as compile time exceptions. These exceptions cannot simply be ignored at the time of compilation; the programmer should take care of (handle) these exceptions.ExampleIf you use FileReader class in your program to read data ... Read More

What is the try block in Java?

Samual Sam
Published on 04-Jan-2018 12:22:36
A try/catch block is placed around the code that might generate an exception. Code within a try/catch block is referred to as protected code, and the syntax for using try/catch looks like the following –Syntaxtry {    // Protected code } catch (ExceptionName e1) {    // Catch block }The ... Read More

What is the catch block in Java?

Swarali Sree
Published on 04-Jan-2018 12:25:02
A catch statement involves declaring the type of exception you are trying to catch. If an exception occurs in the try block, the catch block (or blocks) that follows the try is checked. If the type of exception that occurred is listed in a catch block, the exception is passed ... Read More

Does finally always execute in Java?

Sai Subramanyam
Published on 04-Jan-2018 12:36:45
The finally block follows a try block or a catch block. A finally block of code always executes, irrespective of occurrence of an Exception.

What are custom exceptions in Java?

Sharon Christine
Published on 04-Jan-2018 12:46:57
You can create your own exceptions in Java.All exceptions must be a child of Throwable.If you want to write a checked exception that is automatically enforced by the Handle or Declare Rule, you need to extend the Exception class.If you want to write a runtime exception, you need to extend ... Read More

What is a Throwable class in Java?

Monica Mona
Published on 04-Jan-2018 12:56:10
The java.lang.Throwable class is the superclass of all errors and exceptions in the Java language. Only objects that are instances of this class (or one of its subclasses) are thrown by the Java Virtual Machine or can be thrown by the Java throw statement. Following is the declaration for java.lang.Throwable ... Read More

What is exception propagation in Java?

Lakshmi Srinivas
Published on 04-Jan-2018 12:59:45
If an exception occurs in the protected code, the exception is thrown to the first catch block in the list. If the data type of the exception thrown matches ExceptionType1, it gets caught there. If not, the exception passes down to the second catch statement. This continues until the exception ... Read More

What are I/O classes in Java?

Swarali Sree
Published on 04-Jan-2018 14:28:49
The java.io package contains nearly every class you might ever need to perform input and output (I/O) in Java. All these streams represent an input source and an output destination. The stream in the java.io package supports many data such as primitives, object, localized characters, etc.A stream can be defined as ... Read More

What is Deserialization in Java?

Monica Mona
Published on 04-Jan-2018 14:57:35
After a serialized object has been written into a file, it can be read from the file and Deserialized that is, the type information and bytes that represent the object and its data can be used to recreate the object in memory.Exampleimport java.io.*; public class DeserializeDemo {    public ... Read More

What is the difference between Serialization and Deserialization in Java?

Samual Sam
Published on 04-Jan-2018 15:08:12
Serialization Java provides a mechanism, called object serialization where an object can be represented as a sequence of bytes that includes the object's data as well as information about the object's type and the types of data stored in the object.Exampleimport java.io.*; public class SerializeDemo {    public static void ... Read More
Advertisements