Strings
- Which of these class is superclass of String and StringBuffer class?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
java.lang
- Which of this method of class String is used to obtain a length of String object?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Method length() of string class is used to get the length of the object which invoked method length().
- Which of these operators can be used to concatenate two or more String objects?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Operator + is used to concatenate strings, Example String s = “i ” + “like ” + “java”; String s contains “I like java”.
- Which of these method of class String is used to extract a single character from a String object?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
charAt()
- What is the output of this program?
public class Result
{
public static void main(String[]args)
{
String[] array = { "for", "tea", "too" };
String num= (array.length > 2) ? array[2]: null;
}
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
The value at the 0th position will be assigned to the variable num.