Java Annotation Types

Java Annotation Types

Contents1 Java Annotation Types2 1. Predefined annotations2.1 2. Custom annotations2.1.1 3. Meta-annotations3 Predefined Annotation Types3.1 1. @Deprecated3.1.1 Example 1: @Deprecated annotation example4 2. @Override4.1 Example 2: @Override annotation example5 3. @SuppressWarnings5.1 Example 3: @SuppressWarnings annotation example6 4. @SafeVarargs6.1 Example 4: Read More …

Java Annotations

Java Annotations

Contents1 Java Annotations2 Example 1: @Override Annotation Example3 Annotation formats3.1 1. Marker Annotations3.2 2. Single element Annotations3.2.1 3. Multiple element Annotations4 Annotation placement4.1 1. Above declarations4.1.1 Example 2: @SuppressWarnings Annotation Example5 2. Type annotations6 Types of Annotations6.1 1. Predefined annotations6.1.1 Read More …

Java try-with-resources

Java try-with-resources

Contents1 Java try-with-resources2 Example 1: try-with-resources3 Suppressed Exceptions3.1 Retrieving Suppressed Exceptions4 Advantages of using try-with-resources4.1 1. finally block not required to close the resource4.1.1 Example 2: Close resource using finally block5 2. try-with-resources with multiple resources5.0.1 Example 3: try with Read More …

Java catch Multiple Exceptions

Java catch Multiple Exceptions

Contents1 Java catch Multiple Exceptions2 Example 1: Multiple catch blocks3 Handle Multiple Exceptions in a catch Block3.1 Example 2: Multi-catch block4 Catching base Exception4.1 Example 3: Catching base exception class only4.1.1 Example 4: Catching base and child exception classes Java Read More …

Java throw and throws

Java throw and throws

Contents1 Java throw and throws2 Java throws keyword3 Example 1: Java throws Keyword4 Throwing multiple exceptions5 throws keyword Vs. try…catch…finally6 Java throw keyword7 Example 2: Java throw keyword8 Example 3: Throwing a checked exception Java throw and throws Java throw Read More …

Java Exception Handling

Java Exception Handling

Contents1 Java Exception Handling2 Catching and handling exceptions2.1 Java try…catch block2.1.1 Example 1: try…catch blocks3 Multiple Catch blocks3.1 Example 2: Multiple catch blocks4 Java finally block4.0.1 Example 3: finally block4.0.2 Example 4: try, catch and finally blocks5 Working of try…catch…finally Read More …

Java Exceptions

Java Exceptions

Contents1 Java Exceptions2 Java Exception hierarchy3 Errors4 Exemptions5 Java Exception Types6 1. RuntimeException7 2. IOException Java Exceptions In this tutorial, we will find out about exemptions in Java. We will cover errors, exemptions, and various types of exceptions in Java. Read More …

Java Reflection

Java Reflection

Contents1 Java Reflection2 Java class named Class3 Create objects of the class named Class4 using .class5 Get Interfaces5.1 Example: Get Interfaces6 Get Superclass and Access Modifier6.1 Example: Get Superclass and Access Modifier7 Reflecting Fields, Methods, and Constructors8 Reflection of a Read More …