Questions tagged [system.in]

Predefined stream object attached to the standard input in Java console applications.

It's a static variable in Java's System class. This tag is intended for questions about Java applications that read from the standard input.

191 questions
0
votes
1 answer

How do I replace typed text in a console when something is printed there?

I am reading and writing from console created by running my application from a batch file. I am creating a small servlet and I am running into the problem that while I am typing, things are printed (such as things like clients connecting or…
0
votes
1 answer

java: console application main thread spawns a key listener thread

I wrote a tool, which is performing some steps 1..n Some of the steps require user interaction (reading from System.in) Other steps loop until some condition is fulfilled or the user pressed some key (When the user pressed the key the loop should…
radio
  • 897
  • 2
  • 10
  • 25
-1
votes
1 answer

what does should i changed the stdin into with?

I need help. I'm still a beginner in Java, so my knowledge is still weak. There's a lot of tries that I did, I still don't know why my programming build fails. Can you guys help me? package act2i; import java.io.*; public class Act2I { public…
-1
votes
1 answer

Edit the method for using System.in and System.out

I have this methods OutputStream os = new FileOutputStream("out.txt"); InputStream is = new FileInputStream("out.txt"); Transit.outputTransport(Parking, os); System.out.println(Parking.toString()); Transport forOut =…
Jay Castle
  • 49
  • 1
  • 8
-1
votes
3 answers

Why does the string inside println method show twice?

In the following code why does the string inside println method shows twice.What should I do to show the message once per iteration package practicejava; public class Query { public static void main(String[] args) throws java.io.IOException { …
Tushar Mia
  • 375
  • 2
  • 9
-1
votes
2 answers

Read/Catch stdout message in another application

I have an application A which writes a stdout message. Now i will build a second application B which reads the stdout from A. I don't want create a file, the message will be write in the console and should be read from console. I know, that i have…
HaDo
  • 1
-1
votes
2 answers

Java String not storing same value when assigned to Scanner NextLine()

I have come across a problem with the console handler of my code. I don't know if reading in after assigning it to s.nextLine(); discards the current value of in. Not sure if anything else could affect the String from being read correctly in one…
-1
votes
2 answers

is there any alternative way to provide input to readline apart from console?

BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter your name: "); String name = reader.readLine(); can i provide input from java code instead of console ?
Yogesh Borkhade
  • 616
  • 5
  • 10
-1
votes
2 answers

I'm trying to take an input using Scanner(System.in) but it's not letting me. Help!

So I'm trying to take an input from a user using Scanner(System.in) but when i try to type something into the console it won't let me. Can anyone help? Function.show(); Scanner input = new Scanner(System.in); if (input.equals("a")) { …
bananamana
  • 485
  • 1
  • 9
  • 19
-1
votes
4 answers

Cant read last line of my integer input

public static void main(String[] arg) { System.out.println("Enter the pairs: "); Scanner kbd = new Scanner(System.in); while(kbd.hasNextLine() ) { int input1 = kbd.nextInt(); int input2 = kbd.nextInt(); …
Fahad Ali
  • 1
  • 1
-1
votes
2 answers

Trying to loop any users choice int that is either not 1-3 and/or at the end of the process of their selection

I am not sure if I am using public static int correctly as well. All in all I feel like this code is a giant mess where I just kept adding more and more to it that I probably don't need, but this point I still cant quite figure out how to get it to…
-1
votes
1 answer

basic reading input from user in java

I want to read a character and store it into the char[] array and here is my method called getaline public static int getaline(char message[], int maxlength) { int index = 0; while (message[index] != '\n') { message[index] =…
cohsta
  • 187
  • 1
  • 4
  • 14
-1
votes
1 answer

Java. System.in.read() and "\n" in console

Im currently creating a java program which should read the console and print it out, once again. The code looks like this: import java.io.IOException; public class printer { public static void main(String[] args){ int i; try { while…
user3712130
  • 87
  • 1
  • 3
  • 8
-1
votes
1 answer

Java System.in in an if else statement?

I want to be able to implement the System.in input into an if else statement, but have not quite found how, I'm a beginner with java and i'm creating a basic calculator. //if input = fMultiply then multiply if () { answer = fnum *…
-1
votes
2 answers

System.in points to JtextArea and using Scanner with it causes application to hang

I've got a JFrame that contains a single JPanel that contains a single JTextArea. I've successfully managed to point System.out to the JTextArea, but when I try to use Scanner(System.in) to parse input from the JTextArea, it doesn't even seem to…
Nick Dandakis
  • 13
  • 1
  • 4
1 2 3
12
13