What is the purpose of the "module-info.java" file in a Java module?
The module-info.java file is used in Java's module system (introduced in Java 9) to define the dependencies of the module and the packages it exports. This file specifies which other modules the current module requires and which packages are visible to other modules.
How does Java handle memory management and garbage collection?
Java uses an automatic garbage collection mechanism to reclaim memory from objects that are no longer reachable or in use. The garbage collector periodically frees up memory, which helps manage memory efficiently and reduces the risk of memory leaks.
What does the "javac" command do?
The javac command is used to compile Java source code files (.java files) into bytecode files (.class files). This bytecode can then be executed by the Java Virtual Machine (JVM).
What is a JAR file in Java?
A JAR (Java ARchive) file is a compressed file format that bundles multiple Java class files, associated resources, and metadata into a single archive. This makes it easier to distribute and deploy Java applications and libraries.
What is the -classpath option used for when running the java command?
The -classpath option (or -cp) specifies the path where the Java runtime should look for user-defined classes and libraries when running a Java application. This path can include directories and JAR files containing the required classes.