0% found this document useful (0 votes)
5 views

String_Assignment_Java

The assignment focuses on practicing Java String class methods through various tasks, including creating strings, finding their length, and manipulating them with operations like concatenation and substring extraction. A bonus task involves counting vowels and words in a user-inputted sentence. The submission deadline for the assignment is April 15th.

Uploaded by

abhinavdubey599
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

String_Assignment_Java

The assignment focuses on practicing Java String class methods through various tasks, including creating strings, finding their length, and manipulating them with operations like concatenation and substring extraction. A bonus task involves counting vowels and words in a user-inputted sentence. The submission deadline for the assignment is April 15th.

Uploaded by

abhinavdubey599
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

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

You might also like