07:31How to accept user input in Java ⌨️【8 minutes】
From the creator
Java user input scanner #Java #input #scanner import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("What is your name? "); String name = scanner.nextLine(); System.out.println("How old are you? "); int age = scanner.nextInt(); scanner.nextLine(); System.out.println("What is your favorite food?"); String food = scanner.nextLine(); System.out.println("Hello "+name); System.out.println("You are "+age+" years old"); System.out.println("You like "+food); } }
Published 2020-10-13 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.





