Get a list of files and folders in a directory with Java

Before Java 8, you can use the listFiles() method of the File class with the parameter of the directory that we want to get the list of files and directories to do this. Eg:

The return result will be a list of File objects… Read More

Record class in Java

In Java, the concept of immutable refers to classes whose objects do not change information after they are instantiated. Normally, to declare an immutable class, we would: Declare this class as final so that no class can extend from it. Declare the fields of that… Read More

Sealed class in Java

In Java, to prevent the inheritance of a certain class, we will use the final keyword to declare that class. Examples are as follows:

Class Test will not be able to inherit JavaExample class because this JavaExample class is declared with final: A need… Read More

Nested class in Java

Java allows us to define a class that belongs to another class, for example:

Class is defined inside another class, we call it nested class and this other class is called outer class. In my example above, the Builder is a nested class and… Read More