Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

using for loop to search for an input java

import java.util.Scanner;

public class Sample {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String names[] = { "Jasmine", "Lyka", "Marbie", "Efren", "Tiny", "Soleen" };
        System.out.print("Enter a name to search:");
        String search = input.nextLine();
        for (int i = 0; i < names.length; i++) {
            if (names[i].equalsIgnoreCase(search)) {
                System.out.println("We found " + names[i]);
                break;
            }
        }
        input.close();
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: how to change default port in spring boot 
Java :: java cant use string functions after changing an integer into string 
Java :: search and delete class files from jars 
Java :: how to declare a variable when using loops Java 
Java :: print 1 to 10 using for loop in java 
Java :: android java how to show progressdialog in fragment 
Java :: connect as SYSDBA java 
Java :: efficient java code to reverse array elements 
Java :: plug and chug 
Java :: coin flip random java 
Java :: Longest decreasing subsequence in java 
Java :: power of a number in java 
Java :: XmlRootElement Object to String 
Java :: android stop audio playing by activity lifecycle 
Java :: Java Catching base exception class only 
Java :: set maven goals in eclipse 
Java :: java connect socket to POP3 
Java :: leap year java method 
Java :: set integer array value to null java 
Java :: gradle project load test data json file with jackson 
Java :: change order of words in string java 
Java :: import txt.xz file to android studio app 
Java :: java -jar -l resourceses.porperties -i ejemplo.txt -o inject.bin 
Java :: call method without creating object java 
Java :: findng and replacing duplicate values in an array 
Java :: convert jython object to java object 
Java :: getdatetimeinstance android 
Java :: spring generate banner 
Java :: komplettes array ausgeben java 
Java :: spring down load 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =