Created
October 13, 2022 14:44
-
-
Save roopeshsn/31c461a74c954ed85680f1c49602d80c to your computer and use it in GitHub Desktop.
Here's the code snippet to get inputs in java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.roopesh; | |
import java.util.Scanner; | |
public class Input { | |
public static String integerIn(String out) { | |
Scanner scanner = new Scanner(System.in); | |
System.out.println(out); | |
return scanner.nextLine(); | |
} | |
public static int stringIn(String out) { | |
Scanner scanner = new Scanner(System.in); | |
System.out.println(out); | |
return scanner.nextInt(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment