Computer Science, asked by abhranilDutta, 3 days ago

1. Write a program to check whether a word exists in a string or not.​

Answers

Answered by AMRITPAL41269
0

Answer:

I checked

it exists

Explanation:

pls mark me brainliest

Answered by aryan4628
0

Answer:

class check

{

public static void main(String []args)

{

String key = "love";// key is the word to find

String str = "I love India";

String words[]= str.split( " " );

boolean flag= false;

for(int i=0;i < words.length;i++)

if( key.equals(words[i]))

{

flag=true;

break;

}

if( flag)

System.out.println( " word found ");

else

System.out.println(" word not found");

}

}

Similar questions