Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
easy Solved by 13 students

String indexOf Method

< Prev
Next >

Which statement should replace // Missing line in the code segment below to correctly find and assign the starting index of the substring "Java" to the variable index?

public class SubStringSearch {
    public static void main(String[] args) {
        String sentence = "I love programming in Java";
        // Missing line
        System.out.println("Index: " + index);
    }
}
A

int index = sentence.indexOf(“programming”);

B

int index = sentence.indexOf(“in Java”);

C

int index = sentence.indexOf(“Java”);

D

int index = sentence.indexOf(“java”);

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question
Mark for review

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Total Time
Score
#1kaisuki11 0m 00s 100
#2liuwilliam07241011 0m 17s 83
#3cphong200911 0m 30s 70
#4pandasiteitei11 1m 13s 27
#5bommasam00011 1m 22s 18
#6lsj0803092211 1m 37s 3
#7richa.tuli01 1m 30s -100
#8y.seong202712 4m 33s -183
#9jeonsaw172311 16m 03s -863
#10chunxiangxu.cxu22 31m 05s -1,665
Items per page:
10
1 – 10 of 10
No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy|FAQ