Wednesday 22 February 2017

How to declare a new exception in Java

Sample java code to declare a new exception.


public class MyNewException extends Exception {
 private static final long serialVersionUID = -7994546786269588726L;

 public MyNewException() {
  super();
 }

 public MyNewException(String msg) {
  super(msg);
 }
}

Share:

0 comments:

Post a Comment

Popular Posts

Recent Posts

Pages

Powered by Blogger.

About Me

My photo
For the past 10 years, I've been playing with codes using PHP, Java, Rails. I do this for a living and love new things to learn and the challenges that comes with it. Besides programming I love spending time with friends and family and can often be found together catching the latest movie or planning a trip to someplace I've never been before.