Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

user input in java

This is a discussion on user input in java within the Java forums, part of the Software Development category; how we can use the user input in java....

Go Back   Geeks Talk > Software Development > Java
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read

Java Java related Issues and Problems

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-24-2008
Junior Member
 
Join Date: Dec 2008
Location: delhi
Posts: 8
Thanks: 3
Thanked 1 Time in 1 Post
soniyaparjapat is on a distinguished road
Unhappy user input in java

how we can use the user input in java.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-28-2008
Junior Member
 
Join Date: Dec 2008
Location: Kolkata
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
s_ray is on a distinguished road
Thumbs up Re: user input in java

by Using inputreadbuffer class.

or use textbox by using JDK tools in java.
Reply With Quote
  #3 (permalink)  
Old 12-28-2008
Junior Member
 
Join Date: Dec 2008
Location: india
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
orbit.pnk is on a distinguished road
Re: user input in java

using BufferedReader class or by using Scanner class which works from JDK1.5
Reply With Quote
  #4 (permalink)  
Old 12-29-2008
Junior Member
 
Join Date: Dec 2008
Location: delhi
Posts: 8
Thanks: 3
Thanked 1 Time in 1 Post
soniyaparjapat is on a distinguished road
Unhappy Re: user input in java

Quote:
Originally Posted by soniyaparjapat View Post
how we can use the user input in java.
plz tell me the error:-


class input
{
public static void main(String args[]);
Throws IOException;
{ int i;
String str;
BufferReaderbr=newBufferReader(newInputstreamReader(System.in));
System.out.println("enter name");
str = br.Readline()
System.out.println(str);
}
Reply With Quote
  #5 (permalink)  
Old 01-03-2009
Junior Member
 
Join Date: Oct 2008
Location: hyderabad
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
santhu_chantti is on a distinguished road
Re: user input in java

this is santhosh
to perform input operation in java either we can user iostreams or some predefined classes exist in java.util.* package and those util package classes like Random,Scanner(possible to use only from jdk 1.5) etc
i am demonstrating a simple example with Scanner class
in Scanner class we have diffrent methods exist for reading different type of values.
for integer nextInt(), for double nextDouble() etc.

Example:
import java.util.*;
class InputDemo
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
int a,b;
System.out.println("enter a,b values : ");
a=in.nextInt();
b=in.nextInt();
System.out.println("a = "+a+"\tb = "+b);
}
}
and one more way to perform input operation is Command line arguments but every command line argument is treated as String object but to work with integers,float values we have to wrap the String objects into integer,float etc using Wrapper classes like Integer,Float etc defined in java.lang packages
Reply With Quote
Reply

  Geeks Talk > Software Development > Java

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
How to see what work the user had already done by the user on remote desktop Rajanikanth B.V Windows 2 01-20-2009 04:34 AM
accepting input lokeshwarigajendrakumar MainFrame 0 05-06-2008 03:49 AM
Input and output AnnieL4864 VB.NET 1 11-20-2007 05:12 AM
How can I create web part with user input box Husain VB.NET 0 06-06-2007 08:46 PM
How to Clear Input Buffer blenda C and C++ 1 11-12-2006 03:08 PM


All times are GMT -4. The time now is 11:06 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved