Aug 04

Core java interview questions and answers on strings part-63

Number of View: 615

309) In how  many ways we can perform operations on strings in java?

To perform and manipulate strings in java we have three different ways:

1)      Strings

2)      StringBuffer

3)      StringBuilder

String class is introduced in JDK 1.0.

StringBuffer class is introduced in JDK 1.0.

StringBuilder class is introduced in JDK 5.0.

All the three classes are final classes.

All the three classes are subclasses of interface. Continue reading

Jul 27

Java 7 new feature : Switch statements with strings

Number of View: 208

A switch statement is useful when you need to select one of several alternatives based on the value of an integer, a character, or a String variable.

The purpose of a switch statement is to provide a convenient and simple method of making multi-branch selections based upon integer, enumeration, or String expression Continue reading