Skip to content

Instantly share code, notes, and snippets.

@roopeshsn
Created October 13, 2022 14:44
Show Gist options
  • Save roopeshsn/31c461a74c954ed85680f1c49602d80c to your computer and use it in GitHub Desktop.
Save roopeshsn/31c461a74c954ed85680f1c49602d80c to your computer and use it in GitHub Desktop.
Here's the code snippet to get inputs in java
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