Java Code Reorder Easy +10 XP
Simple Class
Arrange to create a valid Java class.
Click lines in the correct order
Available lines5 left
Your order
Click lines above to build your solution.
Show answer and explanation
Answer: public class Person {
public void greet() {
System.out.println("Hello!");
}
}
Class declaration wraps the method, which wraps the print statement.
Hint: Class comes first, method inside.
What this challenge tests
Code Reorder in Java: classes, basics.