Which, inserted at line 4, produces the output true?

Given:
1. class Test {
2. public static void main(String args[]) {
3. String str = new String(“Welcome”);
4. // insert code here
5. }
6. }
Which, inserted at line 4, produces the output true?

Given:
1. class Test {
2. public static void main(String args[]) {
3. String str = new String(“Welcome”);
4. // insert code here
5. }
6. }
Which, inserted at line 4, produces the output true?

A.
System.out.println(str.trim());

B.
System.out.println(str.startsWith(“W”));

C.
System.out.println(str.indexOf(“W”));

D.
System.out.println(str.startsWith(‘W’));

E.
System.out.println(str.indexOf(1));



Leave a Reply 0

Your email address will not be published. Required fields are marked *