java.util.scanner
Is it safe not to close a Java Scanner, provided I close the underlying readable?
If I have a method that takes a reader and I want to operate on the reader with a Scanner like so: Scanner scanner = new Scanner(reader);[详细]
2023-03-04 18:01 分类:问答nextDouble() throws an InputMismatchException when I enter a double
import java.util.*; class Averager { public static double unlimited() { int count = 0; double sum = 0; Scanner scan = new Scanner(System.in);[详细]
2023-03-04 16:42 分类:问答Scanner, nextInt and InputMismatchException
I\'m trying to read a text file and then print out the integers in a loop using the nextInt() function in Java. The text file I have is of the form:[详细]
2023-03-04 14:29 分类:问答My program isn't reading the file as it's supposed to be
I\'m trying to make a int value, which goes up by a counter every second, then when you close the program down, it will the save the value to a .txt file, and then, it SHOULD, when you start up the pr[详细]
2023-03-01 23:37 分类:问答inputs and loops
I\'m trying to do as the picture shows here: This is my code: import java.util.Scanner; public class IcsProject[详细]
2023-03-01 16:38 分类:问答Java - Parsing Text File
I have an input text file in this format: <target1> : <dep1> <dep2> ... <target2> : <dep1> <dep2> ...[详细]
2023-03-01 13:17 分类:问答Java -- reading in hexadecimal numbers using a scanner
In Java, hexadecimal numbers may be stored in the primitive integer type. private static volatile final synchronized int x = 0x2FE;[详细]
2023-02-28 04:24 分类:问答Knowing delimiters for CSV file
This may be a simple question but I have not been able to find a satisfactory answer. I am writing a class in Java that needs to take in a .csv file filled with doubles in three columns. Obviously a .[详细]
2023-02-27 04:25 分类:问答Blank input from scanner - java
What I\'m trying to do is if the user clicks on the enter key the program should throw a BadUserInputException.[详细]
2023-02-25 20:25 分类:问答Detected a new line within a series of numbers in Java
Let\'s say I have a series of numbers like... 1 2 3 4 5 6 7 8 9 0 How could I step through each int, but stop when I reach a new line? I\'m currently using nextInt() and I know that nextLine() w[详细]
2023-02-24 03:58 分类:问答
加载中,请稍侯......