String str1 = "Kolkata".replace('k', 'a');In the above statement, the effect on string Kolkata is
Select an option to see the answer and solution.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
107
Questions
3/6
Page
Pick an option on a question to see the right answer and solution.
String str1 = "Kolkata".replace('k', 'a');Select an option to see the answer and solution.
Select an option to see the answer and solution.
public class Test{
public static void main (String[] args){
String test = "a1b2c3";
String[] tokens = test.split("\\d");
for(String s: tokens)
System.out.print(s);
}
}Select an option to see the answer and solution.
String a = new String("Examveda");
String b = new String("Examveda");
String c = "Examveda";
String d = "Examveda";Select an option to see the answer and solution.
Select an option to see the answer and solution.
String S1 = "S1 ="+ "123"+"456";
String S2 = "S2 ="+(123+456);Select an option to see the answer and solution.
public class Test{
public static void main(String args[]){
String s = "what";
StringBuffer sb = new StringBuffer("what");
System.out.print(sb.equals(s)+","+s.equals(sb));
}
}Select an option to see the answer and solution.
public class Test{
public static void main(String args[]){
Object myObj = new String[]{"one", "two", "three"};
{
for(String s : (String[])myObj)
System.out.print(s + ".");
}
}
}Select an option to see the answer and solution.
public class Test{
public static void main(String args[]){
String str = null;
if(str.length() == 0){
System.out.print("1");
}
else if(str == null){
System.out.print("2");
}
else{
System.out.print("3");
}
}
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
class output
{
public static void main(String args[])
{
StringBuffer s1 = new StringBuffer("Hello");
s1.insert(1,"Java");
System.out.println(s1);
}
}Select an option to see the answer and solution.
class output
{
public static void main(String args[])
{
String c = "Hello i love java";
boolean var;
var = c.startsWith("hello");
System.out.println(var);
}
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
class output
{
public static void main(String args[])
{
String c = " Hello World ";
String s = c.trim();
System.out.println("\""+s+"\"");
}
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
class output
{
public static void main(String args[])
{
String a = "hello i love java";
System.out.println(a.indexOf('e')+" "+a.indexOf('a')+" "+a.lastIndexOf('l')+" "+a.lastIndexOf('v'));
}
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
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));
}
}Select an option to see the answer and solution.