The important one for Interview: String

Posted by
Java Program:String-Java2Career

String is the so common topic you find in any programming language and in any programming interview.You will get atleast one or two questions in interviews from STRING. Mostly asked question like reverse string, check palindrom or not?  Before going to programs,lets know What is String in java? Unlike many other languages that implement string as character arrays, Java implements strings as object of type String.String is a final class in java. It implements Serializable,Comparable and CharSequence interface.String is called immutable.Immutable means which can’t be altered. Means when you need an altered version of an axisting string, a new String object is created that contains the modification.
                       For those cases in which a modified string is desired, java provides two options: StringBuffer and StringBuilder can be modified after they are created.

string

 Following programs asked in interviews about String:

  1. Write a program to reverse a string.(Without using API).
  2. Write a program to check string is palindrom or not?
  3. Write a program to remove a given character.
  4. A program to remove duplicate character from string without lossing the order
  5. Write a program to reverse a string and change first character case  to lower case and last to lower case. ex: if input is Java 2 Career then output should be Reerac 2 Avaj
  6. Java program to find the first letter alphatically in String 

 Apart from these, There are so many programs left, I will post them soon.

Leave a Reply