Throw keyword in Java

In this tutorial, we will learn about throw keyword in Java. The throw keyword in java is used to throw an exception explicitly. We can throw both kinds of checked and unchecked exceptions using this throw keyword. But we mainly use throw keyword to throw custom exceptions(also known as the user-defined exceptions). Check out the following

Throw keyword in Java Read More »

Throws keyword in Java

In this tutorial, we will learn throws keyword in Java. There are many time when compiler finds some suspicious code that might throw a checked exception and warn programmers to solve exceptions. If programmer will not handle this kind of exceptions then the compiler will throw an error while compiling unreported exception XXX must be caught

Throws keyword in Java Read More »

Try Catch block in Java

In this tutorial, we will learn about Try Catch Block in Java. Using Try Catch block is the best way to handle exceptions in Java. We keep all the code that might throw an exception in the try block. The try block is followed by the catch and finally blocks. In this catch and finally blocks, we write code to

Try Catch block in Java Read More »

Exception Handling in Java

In this tutorial, we will learn about an Introduction to Exception Handling in Java. According to the dictionary, the word exception means abnormal and Here Exception handling means to solve abnormal situations which occur while the execution of code. During the execution of the program due to several reasons such as wrong input, or some programming

Exception Handling in Java Read More »

Enum in Java

In this tutorial, we will learn about Enum in Java. In Java Enum is a kind of class and it is used to represent a group of constants. For example days of week and months of the year etc. Enum is only used in case we know all the possible values(constants) on the time of compiling

Enum in Java Read More »

Abstract vs Interface

In the last tutorials two tutorials, we learned about abstract class and interface. In this tutorial, we will learn what is the difference between Abstract class and Interface. Abstract class Interface An abstract class can have both abstract and non-abstract methods. But an Interface can have only abstract methods. We can not perform multiple inheritances in the abstract class. But in the case

Abstract vs Interface Read More »

Interface in Java

In this tutorial, we will learn about Interface in Java. Interface is like an blue print of class. An Interface contain all its variable as static, final and all its methods as abstract. You can say an Interface is a complete Abstract class. We can not instantiate interface same as abstract class we can only use

Interface in Java Read More »

Abstract class in Java

In this tutorial, we will learn about the Abstract class in Java. The main motive of creating an abstract class is to restrict the user to create an object of the class. Abstract classes can only be used with the help of inheritance means we can inherit the abstract class in class. Java provides us “abstract” which we can

Abstract class in Java Read More »

Final Keyword in Java

In this tutorial, we will learn about the final keyword in Java. The main motive of the final keyword is to restrict the user and final keyword can be used to create three kinds of restriction. These are: final with variable final with method final with class Final keyword in Java with variable: The final keyword is to

Final Keyword in Java Read More »

×