What will be the output of the following Java code? class output ...
View Question
What will be the output of the following Java code?
class output
{
public static void main(String args[])
{
String s1 = “Hello”;
String s2 = new String(s1);
String s3 = “HELLO”;
System.out.println(s1.equals(s2) + ” ” + s2.equals(s3));
}
}
What will be the output of the following Java code? class output ...
View Question
What will be the output of the following Java code?
class output
{
public static void main(String args[])
{
String s1 = “Hello i love java”;
String s2 = new String(s1);
System.out.println((s1 == s2) + ” ” + s1.equals(s2));
}
}
What will be the output of the following Java code? class output ...
View Question
What will be the output of the following Java code?
class output
{
public static void main(String args[])
{
String c = “Hello i love java”;
boolean var;
var = c.startsWith(“hello”);
System.out.println(var);
}
}
What will be the output of the following Java code? class output ...
View QuestionWhich of these data type value is returned by equals() method of String class?
a) char b) int c) boolean d) all of the mentioned Answer: c Explanation: ...
View QuestionWhat is the value returned by function compareTo() if the invoking string is less than the string compared?
a) zero b) value less than zero c) ...
View QuestionWhich of these methods of class String is used to check whether a given object starts with a particular string literal?
a) startsWith() b) endsWith() c) Starts() d) ends() Answer: a Explanation: Method startsWith() of string ...
View QuestionWhich of these methods is used to compare a specific region inside a string with another specific region in another string?
a) regionMatch() b) match() c) RegionMatches() d) regionMatches() Answer: d Explanation: regionMatches()
View QuestionWhich of these method of class String is used to compare two String objects for their equality?
a) equals() b) Equals() c) isequal() d) Isequal() Answer: a Explanation: equals()
View Question
What will be the output of the following Java code?
class output
{
public static void main(String args[])
{
char ch;
ch = “hello”.charAt(1);
System.out.println(ch);
}
}
What will be the output of the following Java code? class output ...
View Question