Holler fellow programmers

I have an error that's been bugging me for almost a day now:
I keep getting 14 of this error: class, interface, or enum expected
Yes, 14 different exact same error message basically for every line of code in the inputGetter method below.

Can someone please help... I believe it's a pretty easy solution (maybe)... but I can't find it anywhere. Thanks in advance.

import java.io.*;
import java.util.*;
import java.lang.*;

public class Driver
     public static void main (String[] args) throws IOException
		  int row = 6;
		  int col = 2;

		  double[][] array = new double[rows][cols];

		  inputGetter (row, col, array);


public static void inputGetter (int ROWS, int COLS, double[][] hold)  //Gets input from the user  ****************
	double[][] data = new double [ROWS][COLS];

	File inputFile = new File ("input.dat");
	Scanner keyboard = new Scanner (inputFile);

	PrintWriter outputFile = new PrintWriter ("results.out");
	inputFile.useDelimiter(" ");

	//reading the data file
	while (inputFile.hasNext())
		for (int i=0; i<ROWS; i++)
			for (int j=0; j<COLS; j++)
				Double temp = Double.parseDouble(inputFile.next);
				data[i][j] = temp;



Recommended Answers

All 3 Replies

The main problem is that the right brace ('}') on line 20 needs to be moved to the end of the file.

You want ONE '}' to close the main method. And right after that you want the 'public ... inputGetter ....' procedure.

commented: Was a big help :D +1

Woah... bro... thanks a lot.
That was it.
Thank you thank you thank you :)

Yep; sometimes it is just that simple. ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.