Train your Java skill with quizzes and workouts
Java is one of the most popular programming languages in the world, in part because it can be used to implement almost anything needed.
Strengthen your Java skills by taking our weekly multiple choice quizzes that test your ability to read and understand Java code. Learn new tricks on a variety of topics such as the collections, exceptions, performance, microservices so much more.
The quizzes are written by professional Java developers - and you can submit your own quizzes to be played by developers from around the world!
You need an Oracle Account to join Oracle Dev Gym. Click here to sign up. |
Take free Java quizzes online
We have a large library of Java quizzes for you to choose from. These range in difficulty from beginner through to expert level. So whatever your skill level, you're sure to find something to challenge and teach you.
Here's a sample Java quiz
Sample quiz (assume Java 8 or higher)
I create this class.
import java.time.LocalDate; import java.time.Month; import java.time.Period; import java.time.temporal.ChronoUnit; import java.util.Arrays; import java.util.List; public class DateChallenge { public static void main(String... doYourBest) { ListspiderManList = Arrays.asList( new SpiderMan("The Spider Man", LocalDate.of(1962, Month.SEPTEMBER, 8)), new SpiderMan("The Black Suit", LocalDate.of(1984, Month.SEPTEMBER, 8)), new SpiderMan("Spider-Man 2099", LocalDate.of(1992, Month.SEPTEMBER, 17))); LocalDate now = LocalDate.of(2017, Month.SEPTEMBER, 18); spiderManList.forEach( s -> { Period period = Period.between(s.creationDate, now); System.out.println(s.costume + " " + period.get(ChronoUnit.YEARS) + " years " + period.get(ChronoUnit.DAYS) + " days"); } ); } static class SpiderMan { String costume; LocalDate creationDate; SpiderMan(String costume, LocalDate dateOfBirth) { this.costume = costume; this.creationDate = dateOfBirth.plusDays(2).plusYears(2); // Line 32 } } }
What will happen after the main method is executed as follows?
javac DateChallenge.java java DateChallenge
Choices - Select all that apply.
Choice 1
The Spider Man 53 years 8 days The Black Suit 31 years 8 days Spider-Man 2099 22 years 30 days
Choice 2
DateTimeException will be throw at the line 32
Choice 3
The Spider Man 55 years 10 days The Black Suit 33 years 10 days Spider-Man 2099 24 years 1 days
No Choice Correct (Collapsible)
Workouts to train your database design muscles
Our top workouts
Oracle Developer Live: Java Innovations
Train your Java skills now
Join Oracle Dev Gym to improve your Java understanding. Browse our quiz library and jump right in.