1z0-830: Java SE 21 Developer Professional String Practice Questions
The free 1z0-830: Java SE 21 Developer Professional questions that deal with string, with answers and explanations. The full bank and the timed practice test cover every topic the exam asks about.
Question #1
Given a properties file on the classpath named Person.properties with the content: ini name=James And: java public class Person extends ListResourceBundle { protected Object[][] getContents() { return new Object[][]{ {"name", "Jeanne"} }; } } And: java public class Test { public static void main(String[] args) { ResourceBundle bundle = ResourceBundle.getBundle("Person"); String name = bundle.getString("name"); System.out.println(name); } } What is the given program's output?
Correct answer: F
Explanation
ResourceBundle.getBundle looks for a class named Person before a Person.properties file, so the ListResourceBundle subclass wins and its mapping for name, Jeanne, is printed.
Question #10
Given: java var hauteCouture = new String[]{ "Chanel", "Dior", "Louis Vuitton" }; var i = 0; do { System.out.print(hauteCouture[i] + " "); } while (i++ > 0); What is printed?
Correct answer: A
Explanation
A do-while runs the body once, printing Chanel, then evaluates i++ > 0 with i still 0, which is false, so the loop ends after one iteration.
Continue with 1z0-830: Java SE 21 Developer Professional
Unlock the full question bank
You have read the first 10 questions. A subscription opens every question in 1z0-830: Java SE 21 Developer Professional, the full timed practice test, and your progress and weak-topic reporting.
Single exam
$19.99for 30 days
Full question bank and practice test for one exam, for 30 days.
Single exam
$49.99for 1 year
One exam for a full year. Nothing renews and nothing to cancel.
Full access
$39.99/mo
Every exam in the catalogue, month to month.
Full access
$199.99/yr
Every exam in the catalogue for a year.
Already subscribed? Sign in to pick up where you left off.
All 1z0-830: Java SE 21 Developer Professional practice questions →
