Expand|Select|Wrap|Line Numbers
- import java.io.FileNotFoundException;
- import java.io.FileReader;
- import java.util.Scanner;
- import javax.swing.JOptionPane;
- public class samplecode {
- int i = 0;
- int j = 0;
- public static void main(String[] args) {
- double [][] data = new double [24][4]; //declaring array
- Scanner sc = new Scanner("sampledata.txt");//reading in data
- while(sc.hasNextDouble()){ //reading data from file
- sc.nextDouble();
- while ( j < 24){ //outer loop for columns
- while (i <4){ //inner loop for rows
- i++;
- }
- j++;
- }
- }
- }
- }
also it says that i can't make a static referance to a non-static field j and i. i dont understand what this means.