Java String Program Practice Test-5

What will be the output of the following java code?

public class Test {

public static void main(String[] args) {

String s5 = "SANT";

String s6 = "sant";

System.out.println(s5.equalsIgnoreCase(s6));

}

}

What will be the output of the following java code?

public class Test {

public static void main(String[] args) {

String str="";

char c[]={'a','b','c'};

str=str.copyValueOf(c, 0, 4);

System.out.println(str);

}

}

What will be the output of the following java code?

public class Test {

public static void main(String[] args) {

String str = "well";

if (str.valueOf("well") != null) {

System.out.println(true);

} else {

System.out.println(false);

}

}

}

What will be the output of the following java code?

public class Test {

public static void main(String[] args) {

String str = "welcome";

byte[] b = str.getBytes();

System.out.println(new String(b));

}

}

What will be the output of the following java code?

public class Test {

public static void main(String[] args) {

String str = "we";

char[] arr = new char[] { ' ', ' ' };

str.getChars(0, 1, arr, 2);

System.out.println(str);

}

}

Java String Program Practice Test-5 Read More »