首页 > 代码库 > java自定义Exception

java自定义Exception

public class JavaTest
{
	public static void main(String[] args)
	{
		try
		{
			throw new DefaultException("This is a defined Exception!");
		}
		catch(DefaultException e)
		{
			System.out.println(e);
		}
	}	
}

class DefaultException extends Exception
{
	public DefaultException(String msg)
	{
		super(msg);
	}
}

java自定义Exception