-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringExplorer.java
More file actions
27 lines (22 loc) · 826 Bytes
/
StringExplorer.java
File metadata and controls
27 lines (22 loc) · 826 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
/*
Aditya Bhatia
10/01/2019
Magpie Lab
*/
public class StringExplorer
{
public static void main(String[] args)
{
String sample = "This is fun.";
// Demonstrate the indexOf method.
int position = sample.indexOf("quick");
System.out.println ("sample.indexOf(\"quick\") = " + position);
// Demonstrate the toLowerCase method.
String lowerCase = sample.toLowerCase();
System.out.println ("sample.toLowerCase() = " + lowerCase);
System.out.println ("After toLowerCase(), sample = " + sample);
// Try other methods here:
int notFoundPsn = sample.indexOf("slow");
System.out.println("sample.indexOf(\"slow\") = " + notFoundPsn);
}
}