I try to set a variable in another class. It does not. It goes to that class and the variable is always 0and the program stops. I know its something basic that I should know but I need it to set the variable and continue in the calling class. Any Help?

package creditcard;
//Credit Card Test - tests CreditCard class

 Debit or Credit transaction (1=Debit, 2=Credit, 0=Exit): 1
Transaction (0=no transaction, +=deposit, -=new charge, -1=Display Logs): -15
Transaction Description: Daily Parking
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.sql.SQLException;
import creditcard.CreditCard.*;
import tio.*;

class CreditCardTest {
    private DebitCard dc;
    private CreditCard cc;
    int hold =0;
    public static void main(String[] args) throws IOException, SQLException, Exception {
        new CreditCardTest();
    public CreditCardTest() throws IOException, SQLException, Exception{
        String f = "CC_Num_status.txt";
        File file = new File(f);
        FormattedWriter fw=new FormattedWriter(f);
        System.out.println("Welcome to the Credit Card simulator!");
        System.out.println("Debit or Credit transaction (1=Debit, 2=Credit, 0=Exit): ");
            CreditCard cc = new CreditCard();


9 Years
Discussion Span
Last Post by orko
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.