Java Scanner String input

前端 未结 5 1326
遇见更好的自我
遇见更好的自我 2020-12-05 11:02

I\'m writing a program that uses an Event class, which has in it an instance of a calendar, and a description of type String. The method to create an event uses a Scanner t

5条回答
  •  广开言路
    2020-12-05 11:30

        Scanner ss = new Scanner(System.in);
        System.out.print("Enter the your Name : ");
        // Below Statement used for getting String including sentence
        String s = ss.nextLine(); 
       // Below Statement used for return the first word in the sentence
        String s = ss.next();
    

提交回复
热议问题