mardi 27 septembre 2016

Assistance with Index in Java - programming 1

could someone please help me with this?

Write a single if...else statement that outputs whether or not the line of text contains any of these lower-case words: "the", "and", "hello"

i tried this but don't think its correct so far:

if(line.indexOf("the") >= 0 || line.indexOf("and") >= 0)
    System.out.print( "Contains one of the words");
        else (

Aucun commentaire:

Enregistrer un commentaire