How to improve my quality of given code?
import java.util.Scanner;
class WordSearch{
public static void main(String[]args)
{
Scanner value=new Scanner(System.in);
String a="Shivakumar is great";
System.out.println("Enter a word for find out:");
String b=value.nextLine();
String[] arrayvalue=a.split(" ");
for(String c:arrayvalue)
{
if(b.equals(c))
{
System.out.print(b);
} else{ System.out.println("Not"); }
} } }
} else{ System.out.println("Not"); }
} } }
3 Replies
⌛
This post has been reserved for your question.
Hey @Shivakumar R! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
Please format your code to make it more readable. For java, it should look like this:
Post Closed
This post has been closed by <@1338078366926110720>.