Tag Archives: Java tutorial

Java tutorials for Beginners – Java List

(Java programming Example for Beginners) Java List In this tutorial, we will learn about the List interface in Java and its methods. In Java, the List interface is an ordered collection that allows us to store and access elements sequentially. It extends the Collection interface. Classes that Implement List Since List is an interface, we cannot create objects from it. In …

Java tutorials for Beginners – Java Collection Interface

(Java programming Example for Beginners) Java Collection Interface In this tutorial, we will learn about the Java Collection interface and its subinterfaces. The Collection interface is the root interface of the Java collections framework. There is no direct implementation of this interface. However, it is implemented through its subinterfaces like List, Set, and Queue. For example, the ArrayList class implements the List interface which …

Java tutorials for Beginners – Java Collections Framework

(Java programming Example for Beginners) Java Collections Framework In this tutorial, we will learn about different interfaces of the Java collections framework. The Java collections framework provides a set of interfaces and classes to implement various data structures and algorithms. For example, the LinkedList class of the collections framework provides the implementation of the doubly-linked list data structure. Interfaces …

Java tutorials for Beginners – Java Assertions

(Java programming Example for Beginners) Java Assertions In this tutorial, we will learn about the Java assert statement (Java assertions) with the help of examples. Assertions in Java help to detect bugs by testing code we assume to be true. An assertion is made using the assert keyword. Its syntax is: assert condition; Here, condition is a boolean expression that …

Java tutorials for Beginners – Java Annotation Types

(Java programming Example for Beginners) Java Annotation Types In this tutorial, we will learn about different types of Java annotation with the help of examples. Java annotations are metadata (data about data) for our program source code. There are several predefined annotations provided by the Java SE. Moreover, we can also create custom annotations as …

Java tutorials for Beginners – Java try-with-resources

(Java programming Example for Beginners) Java try-with-resources In this tutorial, we will learn about the try-with-resources statement to close resources automatically. The try-with-resources statement automatically closes all the resources at the end of the statement. A resource is an object to be closed at the end of the program. Its syntax is: try (resource declaration) { // …

Java tutorials for Beginners – Java throw and throws

(Java programming Example for Beginners) Java throw and throws In this tutorial, we will learn to use throw and throws keyword for exception handling with the help of examples. In Java, exceptions can be categorized into two types: Unchecked Exceptions: They are not checked at compile-time but at run-time.For example: ArithmeticException, NullPointerException, ArrayIndexOutOfBoundsException, exceptions under Error class, etc. Checked Exceptions: They are …

Java tutorials for Beginners – Java Exceptions

(Java programming Example for Beginners) Java Exceptions In this tutorial, we will learn about exceptions in Java. We will cover errors, exceptions and different types of exceptions in Java. An exception is an unexpected event that occurs during program execution. It affects the flow of the program instructions which can cause the program to terminate …