through the scanner in a different class in a method . and also in the sub class it reads in additional data
public void readData(Scanner scanner)
{
group = scanner.next();
...
Type: Posts; User: ajw1993
through the scanner in a different class in a method . and also in the sub class it reads in additional data
public void readData(Scanner scanner)
{
group = scanner.next();
...
nothing is being read in
there is data there though , all the vehicles have regNo's and its saying that on 112 that it cant find the regNo,.
java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:907)
at java.util.Scanner.next(Scanner.java:1416)
at Vehicle.readData(Vehicle.java:112)
at...
there should be 7 for the car , but it keeps coming up null and not storing anything and no it will follow a comment , blank lines then [Van data , then do the van data
yeah ino but how do i record it n use the result .
thats what the code is , thats why im confused
the deal code will create an object , read in the data and also store it in the array
else
{
Scanner scanner2 = new Scanner(lineOfText);
...
thats what i think should work , when looking at the psuedo code =
while ( there are more lines in the file)
{
lineoftext = nextline from scanner
if (line start with //)
{
ignore
}
else if...
there is no problem yet because i just wanted to get this bit right first and it is else if(lineOfText.startsWith("[")
just wondering what should i put
--- Update ---
there is no problem yet...
I have a ptoblem i have 3 types of data in one file for example car data , van data , truck data. The problem is i have to have a flag to check what data is next and set a variable , so we know what...