10/08/2013

1124 - Celebrity jeopardy - Java

1124 - Celebrity jeopardy - Java
 
 import java.util.Scanner;  
 //1124  
 public class CelebrityJeopardy {  
      public static void main(String[] args) {  
           Scanner scanner = new Scanner(System.in);  
           while(scanner.hasNext()) {  
                System.out.println(scanner.nextLine());  
           }  
           scanner.close();  
      }  
 }  

2 comments:

  1. what is problem with my code?? can you please tell me??
    import java.util.Scanner;
    public class Main{
    public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    System.out.println(sc.nextLine());
    }
    }

    ReplyDelete
    Replies
    1. Nothing :) It runs fine. It's not showing anything because it's waiting for your input. If you run this app from command line, you will see that program starts and is waiting. Input some text to it, press enter and voila! This same string will appear on standard output.

      Delete