java自定义Exception

2020-11-25 00:24

阅读:718

标签: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);
	}
}
mamicode.com,搜素材

java自定义Exception

标签:java   自定义exception   

原文地址:http://blog.csdn.net/cjc211322/article/details/24811021


评论


亲,登录后才可以留言!