Challenge: Quotes and Tabs
Completed
Print these two lines. The space in the first line is a tab (\t):
Name: Java Motto: "Write once, run anywhere"
Input
None.
Output
The two lines above.
Example
Output
Name: Java Motto: "Write once, run anywhere"
Editor
Java
Hints
\t gives a tab.
Write \" to put a double quote inside text.
Solution explanation
\t is a tab and \" puts a quote inside a string without ending it.
Show solution
public class Main {
public static void main(String[] args) {
System.out.println("Name:\tJava");
System.out.println("Motto: \"Write once, run anywhere\"");
}
} Output
Answer
You can practice without logging in. Log in to save completion.
Save your progress
You're practising as a guest, so your progress won't be saved.
- Track every lab you complete
- Earn verifiable lab certificates
- See your progress in every module