错误:找不到或加载主类

时间:2012-11-13 17:19:42

标签: java main

我在运行以下代码时遇到问题,它显示Error: Could not find or load main class但我在代码中明显有一个主...

    package abc;

import java.io.IOException;
import javax.swing.JOptionPane;

// As its name implies, this is what is driving the program, asking for input, giving output, etc.
public class driver
{
    @SuppressWarnings("unused")
    public static void main(String args[]) throws IOException // a main that throws an exception... hmmm... yes it's odd, but apparently not illegal
    {
        ....}

    private static void processTransaction(String trans, Customer[] customers) throws IOException // this is the function that processes the given transaction
    {
        ...
}

// An object representing a person who may have one or more bank accounts
class Customer
{
    ...
}

class BankAccount 
{
    ...
}

class CheckingAccount extends BankAccount // extends BankAccount with added functionality
{
    ...
}

class SavingsAccount extends BankAccount // extends BankAccount with added functionality
{
    ...
}

1 个答案:

答案 0 :(得分:6)

尝试将您的班级访问说明符提供给公开

public class driver