Java J2EE Question and Answers

5. Define immutable object?
  An immutable object can't be changed once it is created.
 
Your Name Your Email-ID
Your Answer
6. What is String subsequence method?
 
  • Java 1.4 introduced Char Sequence interface and String implements this interface, this is the only reason for the implementation of sub Sequence method in String class.
  • Internally it invokes the String substring method.
 
Your Name Your Email-ID
Your Answer
7. How to split String in java?
  We can use split (String regex) to split the String into String array based on the provided regular expression.
 
Your Name Your Email-ID
Your Answer
8. What are different ways to create String Object?
 
  • We can create String Object using new operators like any normal java class or we can use double quotes to create a String object.
  • There are several constructors available in String class to get String from char array, byte array, StringBuffer and StringBuilder.
 
Your Name Your Email-ID
Your Answer
12345 Page 2 of 5