Now that we have looked at the actual code lines and have understood how the algorithm works, let's look at the more global structures of the code that brings it together—classes and packages enclosing the methods.
Every file in a Java program defines a class. Any code in a Java program is inside a class. There is nothing like global variables or global functions as in C, Python, Go, or other languages. Java is totally object-oriented.
There can be more than one class in a single file, but usually, one file is one class. Later, we will see that there are inner classes when a class is inside another class, but, for now, we will put one class into one file.