We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent edd4f88 commit 3eb97d7Copy full SHA for 3eb97d7
2 files changed
ch10/Append.java
@@ -0,0 +1,13 @@
1
+import java.util.Scanner;
2
+public class Append {
3
+ public static void main(String[] args) {
4
+ Scanner in = new Scanner(System.in);
5
+ System.out.println("Enter 10 lines:");
6
+ String text = "";
7
+ for (int i = 0; i < 10; i++) {
8
+ String line = in.nextLine(); // new string
9
+ text = text + line + '\n'; // two more strings
10
+ }
11
+ System.out.print("You entered:\n" + text);
12
13
+}
ch10/Surprise.java
@@ -0,0 +1,9 @@
+public class Surprise {
+ String s1 = "Hi, Mom!";
+ String s2 = "Hi, " + "Mom!";
+ if (s1 == s2) { // true!
+ System.out.println("s1 and s2 are the same");
0 commit comments