Joined: Tue Mar 27, 2007 10:55 pm Posts: 2103 Location: Earth Has thanked: 39 time Have thanks: 56 time
Read from command line : This code allow you to read from console in Java.
Code:
import java.util.Scanner;
/** * * @author SAMI */
public class Main {
public static void main(String[] args) { // TODO code application logic here Scanner LineInput=new Scanner(System.in);
System.out.println("Please enter your name : "); String name=LineInput.nextLine(); System.out.println("Please enter your age : "); int Age=LineInput.nextInt(); System.out.println("Dear member : "+name); System.out.println("Your age is : "+Age);
}
}
_________________ Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )