I've got a record class and a createRandomFile class along with the read and
write classes. My problem is when I recompile my record class and change
my record size the record size does not change.
CODE:
// NOTE: This method contains a hard coded value for the
// size of a record of information.
public static int size() { return 72; }
}

if I change the .dat size() amount to say 200 so I can add more fields down
the road if I need them, the original 72 bytes remain for my 100 records.
the file size always stays 7200 bytes when I check the size of my .dat file.
I've changed the class names, deleted the .class files and .dat file and
recompiled. the .dat file always reads 7200 bytes.I can't seem to figure
it out or is this a bug in the java.

I'm using the jdk1.3 on W98 from the dos prompt

Both files area included below. The problem could be to my system only.
The "public static int size() { return 72; }" statement is at the bottom
of
the RecordJ1 class File.
Any help would be greatly appreciated.

/**********************code for RecordJ1.java***************************/
// Record class for the RandomAccessFile programs.


import java.io.*;
import javax.swing.*;


public class RecordJ1 {
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 ).replace( '\0', ' ');

char last[] = new char[ 15 ];

for ( int i = 0; i < last.length; i++ )
last[ i ] = file.readChar();

lastName = new String( last ).replace( '\0', ' ');

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 );
}


//method for calculating shipping cost
public double shippingCost(){ //***method to calculate shipping cost

int width, height, depth;
int cubicVolume;
String w_input, h_input, d_input;


w_input=JOptionPane.showInputDialog( //frames to read in volume
"Enter Box Width in inches: " );

h_input=JOptionPane.showInputDialog(
"Enter Box Height in inches: " );

d_input=JOptionPane.showInputDialog(
"Enter Box Depth in inches: " );

width = Integer.parseInt( w_input ); //converts string to int for calculations
height = Integer.parseInt( h_input );
depth = Integer.parseInt( d_input );

cubicVolume = (((width * height) * depth) / 12); //calculate volume



double weight = 0;
//weight = 0;
String boxWeight_input;


boxWeight_input = JOptionPane.showInputDialog( //read in weight
"Enter the weight of parcel in pounds: " );

weight = Double.valueOf(boxWeight_input).doubleValue();



double shipping_Cost = 0;
//shipping_Cost = 0.0;

double region_Cost;
String regionCost_input;
int regionCost;

regionCost_input = JOptionPane.showInputDialog( //read in region code
"Enter shipping region: " +
"\nPacific = 0" +
"\nMountain = 1" +
"\nCentral = 2" +
"\nEastern = 3");
regionCost = Integer.parseInt(regionCost_input);



switch(regionCost) { //calculate region cost

case 0: region_Cost= 14.0;
break;

case 1: region_Cost= 10.0;
break;

case 2: region_Cost= 7.0;
break;

case 3: region_Cost= 5.0;
break;

default:region_Cost=2.0;
break;

}//End switch



shipping_Cost = ((cubicVolume * weight ) * .001) + region_Cost; //calculate
cost =
//(weight * volume * .001) + region_cost

return ( shipping_Cost ); //***convert double to string

}//End method


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; }
}
/**************************end code RecordJ1.java*************************/



/************************code for CreateRandomFileJ1.java***************/


// This program creates a random access file sequentially
// by writing 100 empty records to disk.

import java.io.*;

public class CreateRandomFileJ1 {
private RecordJ1 blank;
private RandomAccessFile file;

public CreateRandomFileJ1()
{
blank = new RecordJ1();

try {
file = new RandomAccessFile( "randomFileJ1.dat", "rw" );

for ( int i = 0; i < 100; i++ )
blank.write( file );
}
catch( IOException e ) {
System.err.println( "File not opened properly\n" +
e.toString() );
System.exit( 1 );
}

}

public static void main( String args[] )
{
CreateRandomFileJ1 accounts = new CreateRandomFileJ1();
}
}
/****************************end code CreateRandomFileJ1.java**********/