Assignment Title: Working with Strings in Java
Objective:
To understand and practice the use of Java String class and its built-in methods.
Tasks to Complete:
1. Create a Java program that demonstrates the following String operations:
- Creating strings using literals and the new keyword.
- Finding the length of a string.
- Converting a string to uppercase and lowercase.
- Concatenating two strings.
- Comparing two strings using .equals() and .compareTo().
- Finding a character at a specific index using .charAt().
- Finding the index of a character or substring using .indexOf() and .lastIndexOf().
- Extracting a substring using .substring().
- Replacing characters or substrings using .replace().
2. Bonus Task:
- Take a sentence as input from the user and count the number of vowels and words in it.
Sample Output Example:
Original String: Hello World
Length: 11
Uppercase: HELLO WORLD
Lowercase: hello world
Concatenated String: Hello World Java
Character at index 4: o
Index of 'o': 4
Substring from index 6: World
Replaced String: Hello Java
Submission Deadline:
15th April