Skip to content

Instantly share code, notes, and snippets.

@zyryc
Created May 7, 2021 11:23
Show Gist options
  • Save zyryc/f17575f57c121d51c343b5e99e0fc7f3 to your computer and use it in GitHub Desktop.
Save zyryc/f17575f57c121d51c343b5e99e0fc7f3 to your computer and use it in GitHub Desktop.
Print statement like python in java :-)
import java.util.Scanner;
public class Mains {
public static void main(String[] args) {
print("What is your name ? :");
String input = input();
print("your name is : " + input);
}
public static void print(String str) {
System.out.println(str);
}
public static String input() {
Scanner myObj = new Scanner(System.in);
String input = myObj.nextLine();
myObj.close();
return input;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment