Building Log Entry
A program processes a username and a status flag, concatenating parts of the input to form a formatted system log.
What is printed when the following Java program is compiled and run?
public class QuestionTrace {
public static void main(String[] args) {
String input = "user_active";
int split = input.indexOf("_");
String part1 = input.substring(0, split);
String part2 = input.substring(split + 1);
System.out.print(part2 + "-" + part1);
}
}
A
active_user
B
user_active
C
active-user
D
user-active
Question Leaderboard
Not enough data yet to show leaderboard.
