Total members 11895 |It is currently Thu Dec 12, 2024 1:48 am 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
 Command Line Parser Code Using C++     -  
 c program - command line prompt - need help     -  
 program to run shell command line functions     -  
 Command line chat (client and server)     -  
 How to implement Command Line Parser in C++ Code     -  
 Reading a File Line by Line in php     -  
 Line Rotation 2D     -  
 Line Translation 2D     -  
 Line Styles in java     -  
 getting a full line input     -  



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