Hi there,
Im trying to write code for an assignment that is due tommorow and my head is wrecked with this. My program compiles perfectly but when I try to run it Im getting a message that says : Exception in thread "main" java.lang.NoSuchMethodError: main
Press any key to continue . . .
can someone please tell me whats wrong with my code?
import java.io.*; public class CreditUnion { private int account; private String lastName; private String firstName; private double balance; //read a record from the specified RandomAccessFile public void read(RandomAccessFile file) throws IOException { account=file.readInt(); char first[] =new char[ 15 ]; for (int i=0; i < first.length;i++) first [ i ]=file.readChar(); firstName =new String ( first ); char last[]= new char [ 15 ]; for (int i=0; i < last.length; i++) last [ i ]=file.readChar(); lastName =new String( last); balance=file.readDouble(); } //write a record to the specified RandomAccessFile public void write( RandomAccessFile file ) throws IOException { StringBuffer buf; file.writeInt( account ); if (firstName !=null ) buf= new StringBuffer( firstName ); else buf =new StringBuffer( 15 ); buf.setLength( 15 ); file.writeChars( buf.toString() ); if (lastName != null) buf =new StringBuffer( lastName ); else buf= new StringBuffer( 15 ); buf .setLength( 15 ); file.writeChars( buf.toString() ); file.writeDouble( balance ); } public void setAccount( int a ) {account = a;} public int getAccount() {return account; } public void setfirstName( String f ) {firstName =f;} public String getfirstName() {return firstName;} public void setlastName( String l ) {lastName =l;} public String getlastName() {return lastName;} public void setBalance( double b ) {balance =b;} public double getBalance() {return balance; } //Note: This method contains a hard coded value for the //size of a record of information public static int size() { return 72;} }