• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

need help in programming please...

Semidevil

Diamond Member
ok,

so I want to write a test that will ask the user to input an int, and then output it to DOS in java.

how do I do this? I use I/O to do it right?

is it something like:

import java.io.*;
class test
{
public void BufferedReader(Reader in)
{
BufferedReader in = new BufferedReader(new FileReader());
}
}

I'm reading the java docs, but this is all I can come up with. am I even close?? buffered Reader is what asks for the input rigt? how do I make it come out?

help help. just a simple concept.
 
Getting text input from the command prompt is hard. When I was taking Java 101, I remember being given custom classes to get input from the command prompt.

Sorry I can't help you, I don't have access to those class files.
 
String text = "";
BufferedReader keyboard = new BufferedReader(new InputStreamRader(System.in));
try{
text = keyboard.readLine();
}
catch(IOException trash){
System.out.println("error");
}

System.out.println("You typed: " + text);
 
thanx.......what if I want to make it to ask for an int??? I changed String text to Int text, but that just gave a bunch of errors..........
 
Back
Top