summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--java.html.markdown6
1 files changed, 5 insertions, 1 deletions
diff --git a/java.html.markdown b/java.html.markdown
index 9c60eabc..a27a68ca 100644
--- a/java.html.markdown
+++ b/java.html.markdown
@@ -463,7 +463,11 @@ public class LearnJava {
// <second value>"
int foo = 5;
String bar = (foo < 10) ? "A" : "B";
- System.out.println(bar); // Prints A, because the statement is true
+ System.out.println("bar : " + bar); // Prints "bar : A", because the
+ // statement is true.
+ // Or simply
+ System.out.println("bar : " + (foo < 10 ? "A" : "B"));
+
////////////////////////////////////////
// Converting Data Types