Category Archives

Abstract Classes in Java

In C++, if a class has at least one pure virtual function, then the class becomes abstract. Unlike C++,...

Abstract Classes in Java

In C++, if a class has at least one pure virtual function, then the class becomes abstract. Unlike C++,...

Access specifiers for classes or interfaces in Java

In Java, methods and data members of a class/interface can have one of the following four access specifiers. The...

Access specifiers for classes or interfaces in Java

In Java, methods and data members of a class/interface can have one of the following four access specifiers. The...

Access specifier of methods in interfaces

In Java, all methods in an interface are public even if we do not specify public with method names....

Access specifier of methods in interfaces

In Java, all methods in an interface are public even if we do not specify public with method names....

Interfaces in Java

Like a class, an interface can have methods and variables, but the methods declared in an interface are by...

Interfaces in Java

Like a class, an interface can have methods and variables, but the methods declared in an interface are by...

Chained Exceptions in Java

Chained Exceptions allows to relate one exception with another exception, i.e one exception describes cause of another exception. For...

Chained Exceptions in Java

Chained Exceptions allows to relate one exception with another exception, i.e one exception describes cause of another exception. For...

Multicatch in Java

Prior to Java 7, we had to catch only one exception type in each catch block. So whenever we...

Multicatch in Java

Prior to Java 7, we had to catch only one exception type in each catch block. So whenever we...

Infinity or Exception in Java when divide by 0?

Consider the following code snippets: public class PrutordotAi { public static void main(String args) { double p = 1;...

Infinity or Exception in Java when divide by 0?

Consider the following code snippets: public class PrutordotAi { public static void main(String args) { double p = 1;...

User-defined Custom Exception in Java

Java provides us facility to create our own exceptions which are basically derived classes of Exception. For example MyException...

User-defined Custom Exception in Java

Java provides us facility to create our own exceptions which are basically derived classes of Exception. For example MyException...

throw and throws in Java

throw The throw keyword in Java is used to explicitly throw an exception from a method or any block...

throw and throws in Java

throw The throw keyword in Java is used to explicitly throw an exception from a method or any block...