Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!

Roman Bohdanov

Greenhorn
+ Follow
since Sep 05, 2021
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Roman Bohdanov

book: Oracle Certified Professional Java SE 11 Programmer I Study Guide Exam 1Z0-815

chapter: 1, Review Question #7

7. Given the following classes, which of the following snippets can
independently be inserted in place of INSERT IMPORTS HERE and
have the code compile? (Choose all that apply.)
package aquarium;
public class Water {
boolean salty = false;
}
package aquarium.jellies;
public class Water {
boolean salty = true;
}
package employee;
INSERT IMPORTS HERE
public class WaterFiller {
Water water;
}
A. import aquarium.*;
B. import aquarium.Water;
import aquarium.jellies.*;
A. import aquarium.*;
import aquarium.jellies.Water;
A. import aquarium.*;
import aquarium.jellies.*;
A. import aquarium.Water;
import aquarium.jellies.Water;
A. None of these imports can make the code compile.



Too many answers A , or it is a problem on my side?
book: Oracle Certified Professional Java SE 11 Programmer I Study Guide Exam 1Z0-815

chapter: 1

If a main() method isn’t present in the class we name with the .java executable, the process will throw an error and terminate. Even if a main() method is present, Java will throw an exception if it isn’t static.



but if the main method is not marked as static Java will also throw an error, not an exception

method main non-static:
Error: Main method is not static in class Main, please define the main method as:
  public static void main(String[] args)