Thursday, 30 June 2016

Java Tutorial : Java Exception handling (throw Exception)


Click here to watch in Youtube :
https://www.youtube.com/watch?v=_s21JjHXsXY&list=UUhwKlOVR041tngjerWxVccw

Click the below Image to Enlarge
Java Tutorial : Java Exception handling (throw Exception) 
ThrowDemo.java
public class ThrowDemo
{

    public static void main(String[] args)
    {
        getNumber("aaa");
    }

    public static int getNumber(String value)
    {
        if (!value.matches("[0-9]+"))
        {
            throw new ArithmeticException();
        }
        return Integer.parseInt(value);
    }

}
Output
Exception in thread "main" java.lang.ArithmeticException
    at ThrowDemo.getNumber(ThrowDemo.java:13)
    at ThrowDemo.main(ThrowDemo.java:6)
Click the below link to download the code:
https://sites.google.com/site/javaee4321/java/ExceptionDemo_throw_exception_App.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/ExceptionDemo_throw_exception_App

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/4babce59a384cb4ab41f12b03cd7d11227a4b186/BasicJava/ExceptionDemo_throw_exception_App/?at=master

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • No comments:

    Post a Comment

    Google+ Followers

    Google+ Badge