- import java.util.*;
- public class Main {
- public static void main(String args[]) throws Exception{
- //write your code here
- Scanner sc=new Scanner(System.in );
- System.out.println("Enter the number of halls:");
- int n=sc.nextInt();
- sc.nextLine();
- List<String> list=new ArrayList<>();
- for(int i=0;i<n;i++){
- System.out.println("Enter the Hall Name "+(i+1));
- list.add(sc.nextLine());
- }
- System.out.println("Enter the hall name to be searched:");
- String s=sc.nextLine();
- if(list.contains(s)) System.out.println(s+" hall is found in the list at position "+list.indexOf(s));
- else System.out.println(s+" hall is not found");
- }
- }
[text] a2
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Editor
You can edit this paste and save as new: