Last active
December 26, 2015 08:08
-
-
Save edolopez/7119703 to your computer and use it in GitHub Desktop.
Example Input/Output 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
| import java.io.*; | |
| public class Age { | |
| public static void main(String [] args) throws IOException { | |
| InputStreamReader inStream = new InputStreamReader(System.in); | |
| BufferedReader systemIn = new BufferedReader(inStream); | |
| String my_name, greeting, myAge, variable; | |
| greeting = "Hello "; | |
| // Your input name, via terminal | |
| System.out.println("Please introduce your name"); | |
| my_name = systemIn.readLine(); | |
| // Your input age | |
| System.out.println("Please introduce your age"); | |
| myAge = systemIn.readLine(); | |
| // Casting = Casteo | |
| numeric_age = Double.parseDouble(myAge); | |
| // numeric_age = Integer.parseInt(myAge); | |
| // Concatenation | |
| // Output | |
| System.out.println(greeting + my_name + "! \nYour age is: " + myAge); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment