Comments and Expressions
Completed
Print the result of 12 + 30, then on the next line the text 12 + 30. Add a single-line comment and a block comment to your code (they don't change the output).
Input
None.
Output
42 then 12 + 30.
Example
Output
42 12 + 30
Editor
Java
Hints
Numbers without quotes are calculated; text in quotes is printed as-is.
// starts a line comment, /* ... */ a block comment.
Solution explanation
The compiler ignores comments; they are notes for people reading the code.
Show solution
public class Main {
public static void main(String[] args) {
// An expression is calculated before printing
System.out.println(12 + 30);
/* Text in quotes is printed exactly as written */
System.out.println("12 + 30");
}
}