VAIBHAV SINGH
Java Assignments

JAVA - JAVA-STRING

Write a program that computes your initials from your full name and displays them.
Ex: if Input String is "Rahul Singh" Then Output of your program should be "RS"
Change First letter of every word into capital in a paragraph.
Ex: Input String = "hello this is test sting. this is second line."

Output = "Hello This Is Test Sting. This Is Second Line."
Program:

class StringDemo{
public static void main(String[] args){
String st1 = "Java";
String st2 = "Java";
String st3 = new String("Java");
String st4 = new String("Java");
}
}


How many Object present in memory ?
Is String Immutable?
What are all other immutable classes we have in Java?
Write Program to get all letter in a string.
Input : "Hi Ther34e."
Output: 7 [all spaces, special chars and number should be excluded]
Program:

class StringDemo{
public static void main(String[] args){
String st1 = "Java";
String st2 = "Java";
String st3 = new String("Java");
String st4 = new String("Java");

System.out.println(st1==st2);
System.out.println(st2==st3);
System.out.println(st3==st4);
st3 = st3.intern();
System.out.println(st1==st2);
System.out.println(st2==st3);
System.out.println(st3==st4);

}
}

What will be the output of above program?
How substring() method works in Java?
Why char[] is more secure than String for storing a password in Java?
What is the right way to check if String is empty in Java?
How to compare two String objects in Java?
How does String concatenation work in Java?
What is the real difference between String, StringBuffer, and StringBuilder in Java?
What is String[] args argument in main() method of Java program?