class output
{
public static void main(String args[])
{
String s1 = "Hello";
String s2 = s1.replace('l','w');
System.out.println(s2);
}
}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
4/6
Page
Pick an option on a question to see the right answer and solution.
class output
{
public static void main(String args[])
{
String s1 = "Hello";
String s2 = s1.replace('l','w');
System.out.println(s2);
}
}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 sb=new StringBuffer("Hello");
sb.replace(1,3,"Java");
System.out.println(sb);
}
}Select an option to see the answer and solution.
1. StringBuilder sb1 = new StringBuilder("123");
2. String s1 = "123";
3. // insert code here
4. System.out.println(sb1 + " " + s1);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 i love java";
int start = 2;
int end = 9;
char s[]=new char[end-start];
c.getChars(start,end,s,0);
System.out.println(s);
}
}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.
Select an option to see the answer and solution.
StringBuffer s1 = "one";
StringBuffer s2 = s1.append("two")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.
Select an option to see the answer and solution.
class String_demo
{
public static void main(String args[])
{
char chars[] = {'a', 'b', 'c'};
String s = new String(chars);
System.out.println(s);
}
}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 = "one";
String s2 = s1 + " two";
System.out.println(s2);
}
}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.