Total members 11890 |It is currently Fri Apr 19, 2024 2:27 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





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);
         
       
       
    }

}




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : read from command line
 c program - command line prompt - need help     -  
 Command Line Parser Code Using C++     -  
 How to implement Command Line Parser in C++ Code     -  
 program to run shell command line functions     -  
 Command line chat (client and server)     -  
 Reading a File Line by Line in php     -  
 Line Translation 2D     -  
 Line Rotation 2D     -  
 getting a full line input     -  
 DDA Line Drawing Algorithm     -  



Topic Tags

Java Files and I/O
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com