import java.util.*; public class Command { public static void main(String[]args){ Scanner sc=new Scanner(System.in); System.out.println("Arguments are:"+Arrays.toString(args)); System.out.println("Enter key"); String key=sc.nextLine(); for(int i=0;i<args.length;i++){ if(key.equals(args[i])){ System.out.println("Key Found at: "+i); break; } } } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter