Java String Program Practice Test-2

What will be the output of the following java code?

public class Test {

public static void main(String[] args) {

String str = "Java, world!";

boolean status = str.startsWith("Java");

System.out.println(status);

}

}

What will be the output of the following java code?

public class Test {

public static void main(String[] args) {

String s = "java spring hibernate";

String[] str = s.split("\\s+");

int i = str.length;

System.out.println(i);

}

}

What will be the output of the following java code?

public class Test {

public static void main(String[] args) {

char ch = '8';

int num = Integer.parseInt("" + ch);

System.out.println(num + 2);

}

}

What will be the output of the following java code?

public class Test {

public static void main(String[] args) {

String str = "Welcome";

char ch = ("" + str).charAt(0);

System.out.println(ch);

}

}

What will be the output of the following java code?

public class Test {

public static void main(String[] args) {

double d = 6.7;

char ch = ("" + d).charAt(0);

int i = (int) ch;

System.out.println(i);

}

}