Total members 11893 |It is currently Tue Nov 05, 2024 4:44 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
 c program - command line prompt - need help     -  
 Command Line Parser Code Using C++     -  
 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 Translation 2D     -  
 Line Rotation 2D     -  
 start a new line in html     -  
 Line Styles in java     -  



Topic Tags

Java Files and I/O






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