-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaString.java
More file actions
22 lines (18 loc) · 871 Bytes
/
JavaString.java
File metadata and controls
22 lines (18 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
public class JavaString {
public static void main(String[] args) {
String message = "Hello World";
String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
System.out.println(alphabet.length()); // output 26
// check the length from a string varibale
int messageLength = message.length(); // output: 11
System.out.println(messageLength);
// make uppercase
String lowerCaseToUpper = "md. sabbir hossain shuvo";
// alternative
System.out.println(lowerCaseToUpper.toUpperCase());
System.out.println(lowerCaseToUpper.toUpperCase());
String findAge = "My age is 20"; // Output: 10
System.out.println(findAge.indexOf("20"));// it is start counting from 0 since 20 belong into the 10 number
// index then output is 10
}
}