Test 25 - Free Java SE 25 certification Mock test - Exam Code 1Z0-831-Oracle certified Java SE 25 Professional
Knowing how to compile, run and package Java code is part of the Developer Professional exam and this free 1Z0-831 mock test covers it from start to finish. It covers source launch mode, compact source files, instance main methods, multi-file programs, JAR creation, runtime images and the migration to modules.
Java 25 makes writing small programs a whole lot easier and you'll see how. A small source file can now contain top level methods and fields without having to declare a class. An instance main method no longer has to be public, static or take any arguments. There are a couple of questions in there about which launch protocol the runtime will pick if there are several main methods present and whether or not a particular file is valid. You'll be running a single file directly via the java command without any separate compile step at all and you'll be working with a multi-file source program where the launcher will compile the other source files that the main file refers to.
Traditional tools are still the way to go. You'll be using the javac options -d, --module-path, --class-path and -p and you'll be making the decision as to which command will run a particular class or module. JAR questions will cover the jar tool, the Main-Class attribute in a manifest and the difference between modular and non-modular JARs. You'll also be looking at module descriptions via java --describe-module and listing modules via java --list-modules.
Runtime images get a dedicated set. The jlink tool produces a pared down runtime with just the modules that an application requires and you'll be able to predict which modules need to be added in order for an application to start. jdeps is used to find the dependencies and the effect of missing requires. Pay attention to the order of the options on the command line as a wrong module path or output directory can result in errors in some of the answers.
Migration wraps this up. You'll be comparing the bottom-up approach (where you modularise the libraries first) with the top-down approach and will determine how automatic modules (the ones named after the JAR file) and the unnamed module behave in each case. Automatic modules will read every other module and export all of their packages (this is a rule that crops up in a number of the questions).
The explanations list the precise command and the result of that command so you can just type it in a terminal. Do the test, then go and try each of the commands on a small project. That's the only way to really cement the detail and that's where the easy marks are.
