Menu

#13 String Handling

1.0
closed
None
2021-10-22
2021-10-20
No

Why is String immutable in java? Answer this question in a very short description as much as possible.

Suppose you have a character array of 's', 't', 'r', 'i', 'n', 'g'. Convert this array into String.

Create a project called StringHandlingPrj and create a class called StringHandlingExample in com.cybersolveit.core.java.strings package with comments and main method included. In this class create a String literal called "Welcome to java programming!". Find out the character at the index : 15. Also, find a substring of the input from 0 index through 15th index. Find out if this string input contains word "Java" or not. Print the index of character 'j' in the input String. Convert the whole String into UpperCase . Also, convert the whole String input into lowercase.

Concatenate another String "October 2021".

Compare two Strings "Hello" with "hello" using compareTo, equals and equalsIgnoreCase methods.

Take out the leading and trailing spaces in this String " trimmed_String ". Find out if the String is Empty or not.

Convert this string "Welcome to USA" into charArray and print the result.

Reverse the string in #7 above.

For all the questions please print the result in the console.

Discussion

  • Subash Shrestha

    Subash Shrestha - 2021-10-21
    • status: open --> accepted
     
  • Subash Shrestha

    Subash Shrestha - 2021-10-22
    • status: accepted --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB