Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Document preview thumbnail
Vista previa 4 fuera de 86 páginas
Examen

NEWEST ORACLE CERTIFIED JAVA PROGRAMMER EXAM | Q&A WITH RATIONALES

Document preview thumbnail
Vista previa 4 fuera de 86 páginas

NEWEST ORACLE CERTIFIED JAVA PROGRAMMER EXAM | Q&A WITH RATIONALES

Vista previa del contenido

NEWEST ORACLE CERTIFIED JAVA
PROGRAMMER EXAM | Q&A WITH
RATIONALES

1. What is the result of the following program?
1: public class Squares {
2: public static long square(int x) {
3: var y = x * (long) x;
4: x = -1;
5: return y;
6: }
7: public static void main(String[] args) {
8: var value = 9;
9: var result = square(value);
10: System.out.println(value);
11: } }
A. -1
B. 9
C. 81

,D. Compiler error on line 9
E. Compiler error on a different line
Correct answer: B
Rationale: Java is pass-by-value, and the
variable `value` on line 8 is never reassigned, so
it remains 9. The `square` method modifies its
own local copy `x`, not the original variable.


2. Which of the following are legal entry point
methods that can be run from the command
line? (Choose all that apply.)
A. private static void main(String[] args)
B. public static final main(String[] args)
C. public void main(String[] args)
D. public static final void main(String[] args)
E. public static void main(String[] args)
F. public static main(String[] args)
Correct answer: D, E
Rationale: Option E is the canonical main
method signature. Option D is also valid as
`final` is redundant but permitted. The method

,must be `public`, `static`, and have a `void`
return type.


3. Which answer options represent the order in
which the following statements can be
assembled into a program that will compile
successfully? (Choose all that apply.)
X: class Rabbit {}
Y: import java.util.*;
Z: package animals;
A. X, Y, Z
B. Y, Z, X
C. Z, Y, X
D. Y, X
E. Z, X
F. X, Z
G. None of the above
Correct answer: C, D, E
Rationale: The correct order is package
(optional), then import (optional), then class. If

, both package and import are present, they must
appear in that order.


4. Which of the following are true? (Choose all
that apply.)
public class Bunny {
public static void main(String[] x) {
Bunny bun = new Bunny();
}}
A. Bunny is a class.
B. bun is a class.
C. main is a class.
D. Bunny is a reference to an object.
E. bun is a reference to an object.
F. main is a reference to an object.
G. The main method doesn't run because the
parameter name is incorrect.
Correct answer: A, E
Rationale: `Bunny` is a class, and `bun` is a
reference variable to an object. The parameter

Información del documento

Subido en
25 de junio de 2026
Número de páginas
86
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$24.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
IsaacRobie
4.0
(78)
Vendido
341
Seguidores
156
Artículos
4368
Última venta
1 semana hace


Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes