Hi.

I'm new to java and I'm trying to run the following code.
VB Code:
  1. import java.io.*;
  2. import java.sql.*;
  3.  
  4.  
  5.     public class ExcelReadTest{
  6.             public static void main(String[] args){
  7.                 Connection connection = null;
  8.  
  9.  
  10.                     try{
  11.                         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  12.                         Connection con = DriverManager.getConnection( "jdbc:odbc:exceltest" );
  13.                         Statement st = con.createStatement();
  14.                         ResultSet rs = st.executeQuery( "Select * from [Sheet1$]" );
  15.  
  16.                         ResultSetMetaData rsmd = rs.getMetaData();
  17.                         int numberOfColumns = rsmd.getColumnCount();
  18.  
  19.  
  20.  
  21.  
  22.                             while (rs.next()) {
  23.  
  24.  
  25.                                     for (int i = 1; i <= numberOfColumns; i++) {
  26.                                         if (i > 1) System.out.print(", ");
  27.                                         String columnValue = rs.getString(i);
  28.                                         System.out.print(columnValue);
  29.                                     }
  30.                                     System.out.println("");
  31.                                 }
  32.  
  33.                                 st.close();
  34.                                 con.close();
  35.  
  36.  
  37.                                 } catch(Exception ex) {
  38.                                     System.err.print("Exception: ");
  39.                                     System.err.println(ex.getMessage());
  40.                                 }
  41.                             }
  42.                     }
When I compile the code, I get this error message: JavaExcel.java:5: class ExcelReadTest is public, should be declared in a file named ExcelReadTest.java. How do I fix this?

Thanks in advance.