Skip to content
Advertisement

Tag: input

Java how to read stdin?

I need to read the input that is piped to my java program. This is a simple task but I couldn’t find it on the net. This is what I tried: First of all, is there a simpler way to do it (in java 11, or maybe with a library)? It seems like a lot of lines for such a

Java user input, declare as int?

I’m new to Java and I want to make a program that calculates price of donuts by typing in how much donuts you want and then telling you what is the price depending on the number of donuts you want. This is the code What am I missing in my code? I am getting an error in the last line.

Scanner needs/is requesting input twice

I’m just writing a small program that receives input from the user then prints it back to them. However, when I run the program it asks for input twice (it prints the initial statement, then once you type and press enter, nothing happens, but if you do it again it works and prints.) The top value apparently has no weight

How to take text input with DialogFragment in Android?

I am trying to get a value that user enters into a Dialog, using the recommended DialogFragment class for it, the Dialog constructs and runs fine, but I cannot return the value of the EditText parameter to the parent class, without get a NullPointerException. My DialogHost class, this constructs, returns and links the parent to its buttons. This is my

java.util.NoSuchElementException – Scanner reading user input

I’m new to using Java, but I have some previous experience with C#. The issue I’m having comes with reading user input from console. I’m running into the “java.util.NoSuchElementException” error with this portion of code: I have two functions that get user input: PromptCustomerQty PromptCustomerPayment If I don’t call PromptCustomerQty then I don’t get this error, which leads me to

ArrayList input java

Im looking at the problem: Write a program which reads a sequence of integers and displays them in ascending order. Im creating an ArrayList (which I am new to) and I want to populate with integers input from the command line. With an array I could use a for loop with but with an ArrayList of unbounded size Im not

Advertisement