Thank you! Just realized the my main problem was not storing the file into a variable ... I needed to use bitsetanswer=oosa.readObject(); it just seemed that it could not just be a simple readObject(). As far as i can tell this works great, could be more efficient but it gets the job done
package lab3;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.BitSet;
public class Test
{
public static void main(String[] args) throws IOException
{
String line;
String userentered;
int counter =0;
double testscore;
BitSet bitsetguess = new BitSet();
Object bitsetanswer = new BitSet();
// bitsetanswer.set(1);
// bitsetanswer.set(2);
FileOutputStream fos = new FileOutputStream("guess.bin");
BufferedOutputStream bos = new BufferedOutputStream(fos);
ObjectOutputStream oos = new ObjectOutputStream(bos);
BufferedReader userInput = new BufferedReader(new InputStreamReader(System.in));
FileInputStream fosa = new FileInputStream("ans.bin");
BufferedInputStream bosa = new BufferedInputStream(fosa);
ObjectInputStream oosa = new ObjectInputStream(bosa);
@SuppressWarnings("resource")
BufferedReader br = new BufferedReader(new FileReader("quizquestions.txt"));
System.out.println("Take the Quiz");
for (int i= 1; i != 26; i++)
{
line = br.readLine();
System.out.println(line);
System.out.println("T or F");
userentered = userInput.readLine();
switch(userentered)
{
case "t": bitsetguess.set(i, true);
break;
case "T":;bitsetguess.set(i, true);
break;
case "f":bitsetguess.set(i, false);
break;
case "F": bitsetguess.set(i, false);
break;
default: System.out.println("Try Again");
break;
}
}
oos.writeObject(bitsetguess);
oos.close();
try
{
bitsetanswer = oosa.readObject();
for (int a =1; a != 26; a++)
{
if (((BitSet) bitsetanswer).get(a) == bitsetguess.get(a))
{
counter = counter +1;
}
}
}
catch (ClassNotFoundException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
oosa.close();
System.out.println("Your Grade Is: ");
testscore=100*(((double)counter)/25);
System.out.println(testscore +"%");
}
}