-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringClass.java
More file actions
27 lines (21 loc) · 879 Bytes
/
Copy pathStringClass.java
File metadata and controls
27 lines (21 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package io.codelex.notes.day04;
public class StringClass {
public static void main(String[] args) {
// Strings are Immutable
String firstString = "text";
String firstSubstring = firstString.substring(1, 3);
System.out.println(firstSubstring);
// Comparing Strings
String one = "test";
String two = "test";
String three = new String("test");
System.out.println("one == two -> " + (one == two));
System.out.println("two == three -> " + (two == three));
System.out.println("two.equals(three) -> " + two.equals(three));
// String Methods
String originalString = "I am the Original String";
String[] splittedString = originalString.split(" ");
boolean containsOriginal = originalString.contains("Original");
// ... and much much more....
}
}