Is there an equivalent method to C's scanf in Java?

前端 未结 7 1176
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-01 11:58

Java has the notion of format strings, bearing a strong resemblance to format strings in other languages. It is used in JDK methods like String#format() for output conversio

7条回答
  •  暖寄归人
    2020-12-01 12:35

    THERE'S an even simpler answer

    import java.io.BufferedReader;
    import java.util.Scanner;
    
    public class Main {
    
        public static void main(String[] args)
        {
            String myBeautifulScanf = new Scanner(System.in).nextLine();
            System.out.println( myBeautifulScanf );
    
        }
    }
    

提交回复
热议问题