Answers for "java read input from stdin"

2

java read string input

import java.util.Scanner;
 
public class YourClass {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String inputString = scanner.nextLine();
        System.out.println("Your string: " + inputString);
    }
}
Posted by: Guest on March-14-2020
0

java stdin

public static void main(String[] args) {
        StdOut.print("Type an int: ");
        int a = StdIn.readInt();
        StdOut.println("Your int was: " + a);
        StdOut.println();
    }
}
Posted by: Guest on August-24-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language