Posts

Showing posts from February, 2018

Java : String

Top 35 Java String Interview Questions And Answers : 1) Is  String  a keyword in java? No.  String  is not a keyword in java.  String  is a final class in  java.lang  package which is used to represent the set of characters in java. 2) Is  String  a primitive type or derived type? String  is a derived type. 3) In how many ways you can create string objects in java? There are two ways to create string objects in java. One is using  new  operator and another one is using string  literals . The objects created using new operator are stored in the heap memory and objects created using string literals are stored in string constant pool. String s1 = new String("abc"); //Creating string object using new operator String s2 = "abc"; //Creating string object using string literal 4) What is string constant pool? String objects are most used data objects in Java. Hence, java has a s...