Created
May 7, 2021 11:23
-
-
Save zyryc/f17575f57c121d51c343b5e99e0fc7f3 to your computer and use it in GitHub Desktop.
Print statement like python in java :-)
This file contains 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
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