Color theme
0 day streak0 XPP1
JavaQuiz mode
MISSION 1 OF 3

Make an exhibit code

0 XP earned
Java track: IntermediateMission: BeginnerString slicingZero-based indexesWhitespace trimming
Before you start this intermediate track

Variables, methods, and typed collections. The lessons use constructors, fields, and maps.

Guided code reading and debugging. Runnable coding challenges are available in JavaScript, Python, and SQL.

x
0 / 6 challenges
KNOWLEDGE CHECK

Predict the result.

What exhibit code and cleaned-title length are printed?

Main.java
public class Main {  public static void main(String[] args) {    String raw = "  ORBIT  ";    String title = raw.strip();    String code = title.substring(0, 3);    System.out.println(code + " (" + title.length() + ")");  }}

Each example is a complete Java 11+ source file named Main.java. Compile with javac Main.java and run with java Main. Each mission is independent.

Review the lesson

String methods return useful views or transformed versions of text. strip removes surrounding whitespace, and substring selects characters between a starting index and an exclusive ending index. Java indexes begin at zero, so indexes zero through two form a three-character code. length reports the number of characters in this ASCII title.

Choose your answer+25 XP on first completion