- How many string objects are created in the following code segment:
System.out.print("Enter a sentence : ");
mySentence = keyboard.next();
System.out.println("The original is : " + mySentence);
mySentence.toUpperCase();
System.out.println("The same one is : " + mySentence);
mySentence = mySentence.toUpperCase();
System.out.println("The raised is : " + mySentence);
- Write a program that prints its command line parameters on the screen.
- What operator concatenates strings?
- What is the output from the following code segment:
String one = "aaa";
String two = "bbb";
String three;
one = one + one;
three = two;
two = three + one;
System.out.println(one + two + three);
- Write a method that returns the number of spaces in a string.
- Explain the difference between
if (aString == anotherString) {
and
if (aString.equals(anotherString)) {
- What is the critical difference between and String and a
StringBuffer?