Maven Flashcards

1
Q

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

A

c) It prints a message to the screen

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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

A

b) It can be accessed from inside and outside the class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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

A

b) It enables the use of experimental features

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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

A

c) It controls how the project is compiled

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

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

A

c) The method name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

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

A

c) To indicate a task for future implementation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly