Maven Flashcards
What is the purpose of the System.out.print("Hello world!");
line in the HelloWorld program?
a) It declares a method
b) It imports a library
c) It prints a message to the screen
d) It accepts user input
c) It prints a message to the screen
What does the public
keyword in a Java method declaration indicate?
a) It can only be accessed within the class
b) It can be accessed from inside and outside the class
c) It can only be accessed by subclasses
d) It is a private method
b) It can be accessed from inside and outside the class
What is the effect of the --enable-preview
flag when running a Java program?
a) It compiles the program faster
b) It enables the use of experimental features
c) It disables warnings
d) It optimizes runtime performance
b) It enables the use of experimental features
What is the function of the maven-compiler-plugin
in the pom.xml file?
a) It defines the name of the project
b) It manages project dependencies
c) It controls how the project is compiled
d) It sets the IDE settings for the project
c) It controls how the project is compiled
In the new anonymous main class feature in Java 21, what is NOT removed from the method declaration?
a) The argument array
b) The static keyword
c) The method name
d) The return type
c) The method name
In the HelloWorld example, why would a comment starting with // be used in the code?
a) To add executable instructions
b) To store metadata
c) To indicate a task for future implementation
d) To mark a line for deletion
c) To indicate a task for future implementation