Tutorialspoint

What are abstract classes in Java?

What are abstract classes in Java?
Giri Raju
Answered on 2nd Jan, 2018

A class which contains the abstract keyword in its declaration is known as abstract class. Abstract classes may or may not contain abstract methods, i.e., methods without body ( public void get(); ) But, if a class has at least one abstract method, then the class must be declared ... Read More

Is final method inherited in Java?

Is final method inherited in Java?
seetha
Answered on 3rd Jan, 2018

No, we cannot override a final method in Java. The final modifier for finalizing the implementations of classes, methods, and variables. We can declare a method as final, once you declare a method final it cannot be overridden. So, you cannot modify a final method from a sub class. The ... Read More

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

What is the difference between checked and unchecked exceptions in Java?
karthikeya Boyini
Answered on 4th Jan, 2018

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?

What is the try block in Java?
Samual Sam
Answered on 4th Jan, 2018

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 –Syntax try {    // Protected code } catch (ExceptionName e1) {    // Catch block }The ... Read More

What is the catch block in Java?

What is the catch block in Java?
Swarali Sree
Answered on 4th Jan, 2018

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?

Does finally always execute in Java?
Sai Subramanyam
Answered on 4th Jan, 2018

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?

What are custom exceptions in Java? 
Sharon Christine
Answered on 4th Jan, 2018

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?

What is a Throwable class in Java?
Monica Mona
Answered on 4th Jan, 2018

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?

What is exception propagation in Java?
Lakshmi Srinivas
Answered on 4th Jan, 2018

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?

What are I/O classes in Java?
Swarali Sree
Answered on 4th Jan, 2018

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?

What is Deserialization in Java?
Monica Mona
Answered on 4th Jan, 2018

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?

What is the difference between Serialization and Deserialization in Java?
Samual Sam
Answered on 4th Jan, 2018

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

What is the difference between System.out, System.in and System.err streams in Java?

What is the difference between System.out, System.in and System.err streams in Java?
Swarali Sree
Answered on 4th Jan, 2018

All the programming languages provide support for standard I/O where the user's program can take input from a keyboard and then produce an output on the computer screen. Similarly, Java provides the following three standard streams:Standard Input: This is used to feed the data to user's program and usually a ... Read More

What are file operations in Java?

What are file operations in Java?
Monica Mona
Answered on 4th Jan, 2018

File class provides various methods to perform respective file operations.canRead(): This method tests whether the application can read the file denoted by this abstract pathname. It returns true if and only if the file specified by this abstract pathname exists and can be read by the application; false otherwise.canWrite(): This ... Read More

How can dead thread be restarted in Java?

How can dead thread be restarted in Java?
Sai Subramanyam
Answered on 4th Jan, 2018

A thread goes through various stages in its lifecycle. For example, a thread is born, started, runs, and then dies. New − A new thread begins its life cycle in the new state. It remains in this state until the program starts the thread. It is also referred to ... Read More

Advertisements
Loading...
Unanswered Questions View All

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.