please help at new at java. i need to save the Set that i just cteated to disk and the load that set from disk? What i am using in my codes doesnt work thanks for u r time public class TestSaveNumbers implements Serializable{
public static void main(String args[]) {
Numbers nu = new Numbers(); Numbers nu1 = new Numbers(); TreeSet a=new TreeSet(new Comp());
TreeSet b=new TreeSet(new Comp());
TreeSet c=new TreeSet(new Comp());
int max_range=30; int total=4; Integer number1; Integer number2; Integer ia; int sequence=1; int quantity; int sequence1; // for (int i=0;i<sequence;i++){ quantity=0; sequence1 = ((int)(max_range*Math.random()+1)); nu.addNumbers(sequence1); System.out.printl n(sequence1); System.out.println("nu"+nu); do{ number1 = new Integer((int)(max_range*Math.random()+1)); number2 = new Integer((int)(max_range*Math.random()+1));
//if (!a.contains(number1)){ a.add(number1); //System.out.println("The Elements of First set:"+a); String astring= String.valueOf(number1); int ve = Integer.parseInt(astring); //String.valueOf(astring); //st.addState(astring); b .add(number2); //set.add(number1);
String bstring= String.valueOf(b); //System.out.println("The Elements Sorted"+set); System.out.println("The Elements of First set:"+a); System.out.println("The Elements of Second set:"+b); //nu.addNumbers(); c.addAll(b); c.addAll(a); System.out.println("The Union of the two sets:"+c); b.retainAll(a); System.out.println ("The Intersection:"+b);
try { // FileDialog dialog = new FileDialog(f, "select file");
String sourceFile="a:\\Numbers.txt"; FileOutputStream foStream = new FileOutputStream(sourceFile); // ObjectOutputStream ooStream = new ObjectOutputStream(foStream); foStream.write();
System.out.println(nu); //System.out.println(a); //if (a==nu){ //System.out.println("They Are equal");} // if( nu.toString()==astring){ ///Why i cant get the true value? ///As you can see i tried differend ways //But still i dont understand why doesnt return //true value? //System.out.println("They Are equal");