Skip to main content

Featured

Game Development Tutorials In Android

Game Development Tutorials In Android Hi Guys,                 We are shortly started Game Development Tutorials in Android Studio. So everyone supports me and share this blogs to your friends. Guys, At this time everyone is freely available to source code and we are provide a video for step by step game developments. you are learn free and feel free to support us. Guys, if you have any question to me, so feel free to comment us. I will try to answer all the question as long as possible.                                                     Thank's                                                                          ...

Exception Handling In Java

Exception Handling In Java


In this Example, we will discuss an important part of Java, Exception is an abnormal condition which is sense that RunTime, Many Types of Exception in Java, But in this program we can generate on exception, and throw our own exception in java .  It's a very important part. So, Any Difficulties to understand this part , feel free to comment below. 

Before we can start to make the Exception Handling Program, click on the Advertisements , available on this page.

Now , Let's Start

                                           "ExceptionText.java"

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

public class ExceptionTest
{
        static int  divide(int first,int second) throws MyException
        {
                if(second==0)
                throw new MyException("can't be divided by zero");
                 return first/second;
        }
        public static void main(String[] args)
       {
           try
          {
                System.out.println(divide(4,0));
          }
          catch (MyException exc)
         {
             exc.printStackTrace();
        }
    }

}


Compile and Run On this Program....

If this information is important to you , and you want to , I will continue writing some more details of Java, Android Programming Language, so click on the advertising, available on this page. This is motivate me for writing some more useful stuff, Thank's 

Comments