Which statement about the main method required to launch a Java SE 8 application from the command line is correct?
Java Basics
Question · Easy
When compiling a source file with javac, what name is required for a file containing the public top-level class Report?
Chapter 1: Introduction & Exam Overview
1.1 About the Oracle Java SE 8 Programmer I (1Z0-808) Exam
Study guide
In a Java source file, which ordering of elements is required for the file to compile?
Question · Medium
Tech Exam Prep Podcast
Listen on Spotify
Podcast
Which import statement correctly imports only the ArrayList class from the java.util package?
Which package is automatically imported into every Java source file without an explicit import statement?
When the Java SE 8 launcher invokes App.main(String[] args) with java App one two three, what does System.out.println(args.length); print?
1.2 How to Use This Guide & Exam-Day Code-Tracing Strategy
Which of the following is a valid Java identifier?
A concrete top-level class declares no constructors and extends a class with an accessible no-argument constructor that has no throws clause. What does the Java compiler supply?
Working With Methods And Encapsulation
Why can the same compiled Java SE 8 application generally run on different operating systems without recompiling?
A public top-level class Order is declared in package com.shop.sales. From a class in package com.shop.web, how can Order be referenced without an import?
Chapter 2: Java Basics
2.1 Variable Scope & Java Class Structure
What is the default value of an instance field declared as int count; in a newly created object?
Working With Java Data Types
What happens when this code is compiled? public class A { public static void main(String[] a){ int x; System.out.println(x); } }
Which assignment compiles without an explicit cast?
What is the result of: byte b = (byte) 200; System.out.println(b);
Question · Hard
2.2 Executable main Method, Command-Line Execution & Console Output
Which declaration uses a valid numeric literal in Java SE 8?
Consider these Java SE 8 declarations: Integer a = 127; Integer b = 127; Integer c = 200; Integer d = 200; What is guaranteed about the two reference comparisons?
Which statement correctly creates an Integer wrapper from the int value 42 using the recommended Java SE 8 approach?
Consider two StringBuilder instances: StringBuilder sb1 = new StringBuilder("a"); StringBuilder sb2 = new StringBuilder("b"); sb1 = sb2; // X Assume there are no other references to either builder. At the source-code level, how many builders lose their last reference at X?
2.3 Packages, Import Declarations & java.lang
What is printed by: String s = "Java"; s.concat(" 8"); System.out.println(s);
Working With Selected Classes From The Java Api
Which keyword designates a variable whose value can never be reassigned after initialization?
After executing char c = 'A'; int n = c + 1; what does System.out.println(n); print?
Inside a method, which declaration compiles without any other variables in scope?
2.4 Java Platform Features & Architecture
What is the scope of a variable declared inside the body of a for loop's statement block?
After executing double d = 10 / 3; what does System.out.println(d); print?
When an int primitive is passed to a method that reassigns its parameter, what effect does that have on the original variable in the caller?
What is the output of: int x = 5; System.out.println(x++ + ++x);
Using Operators And Decision Constructs
Chapter 3: Java Data Types — Primitives, Casting & Wrappers
3.1 Primitive Data Types, Literals & Default Values
Given two non-null String references s1 and s2, which expression returns a boolean that is true exactly when their contents match?
What is the result of: System.out.println(2 + 3 + "X" + 2 + 3);
Given int a = 4; what value does the ternary expression (a > 5) ? "big" : (a > 2) ? "medium" : "small" produce?
Which data type is NOT permitted as the controlling expression of a Java SE 8 switch statement?
3.2 Primitive Casting, Numeric Promotion & final Constants
What is printed by this switch? int n = 2; switch(n){ case 1: System.out.print("1"); case 2: System.out.print("2"); case 3: System.out.print("3"); default: System.out.print("D"); }
The method isReady() returns false. The method sideEffect() prints "S" and returns true. What happens when Java evaluates isReady() & sideEffect()?
What is the value of the expression 17 % 5 in Java?
Given the expression 2 + 3 * 4 - 1, which value does Java compute due to operator precedence?
3.3 Wrapper Classes, Autoboxing, Unboxing & the Integer Cache
What happens when this code is compiled and run? int x = 5; if (x = 3) { System.out.println("yes"); }
Which statement correctly declares and initializes a one-dimensional int array with three elements?
Creating And Using Arrays
What is the default value stored in each element of: String[] names = new String[2];
What is the result of running: int[] a = {10, 20, 30}; System.out.println(a[3]);
Loading more…