Oracle
1Z0-829 · Question #17
1Z0-829 Question #17: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-829 to reveal the answer and full explanation for question #17. The question stem and answer options stay visible for context.
Utilizing Java Object-Oriented Approach
Question
public class Weather {
public enum Forecast {
SUNNY, CLOUDY, RAINY;
}
@Override
public String toString() { return "SNOWY";}
public static void main(String[] args) {
System.out.print(Forecast.SUNNY.ordinal() + " ");
System.out.print(Forecast.valueOf("CLOUDY".toUpperCase()));
}
}
What is the result?
Options
- A1 RAINY
- BCompilation fails
- C1 Snowy
- D0 CLOUDY
- E0 Snowy
Unlock 1Z0-829 to see the answer
You've previewed enough free 1Z0-829 questions. Unlock 1Z0-829 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.
Topics
#enums#ordinal()#valueOf()#toString() override