Results 1 to 3 of 3
  1. #1
    1202910120 is offline Member
    Join Date
    Feb 2014
    Posts
    4
    Rep Power
    0

    Default Exception handling

    Consider the following 3 cases and please explain the output for all these cases.

    1 case

    interface got
    {
    void system() throws Exception;
    }
    public class interface12 implements got {
    public void system()
    {
    System.out.println("hiii");
    }
    public static void main(String aa[])
    {
    interface12 g = new interface12();
    g.system();
    }
    }


    2 case

    interface got
    {
    void system() throws Exception;
    }
    public class interface12 implements got {
    public void system()
    {
    System.out.println("hiii");
    }
    public static void main(String aa[])
    {
    got g1 = new interface12();
    g1.system();
    }
    }

    3 case

    interface got
    {
    void system() ;
    }
    public class interface12 implements got {
    public void system() throws Exception
    {
    System.out.println("hiii");
    }
    public static void main(String aa[])
    {
    interface12 g = new interface12();
    g.system();
    }
    }

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: Exception handling

    Perhaps you should compile and run them and then ask your particular question(s) about their behavior.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Exception handling

    Also the code would be easier to read if its wrapped in code tags.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Exception Handling
    By bigo005 in forum New To Java
    Replies: 8
    Last Post: 01-15-2014, 09:17 PM
  2. Exception handling
    By ExX in forum New To Java
    Replies: 6
    Last Post: 03-12-2012, 12:48 PM
  3. Exception handling
    By Moedig in forum New To Java
    Replies: 2
    Last Post: 11-10-2011, 11:43 PM
  4. exception handling
    By niksipandit in forum New To Java
    Replies: 3
    Last Post: 09-22-2011, 03:25 PM
  5. Exception Handling...
    By focus_nitin in forum New To Java
    Replies: 1
    Last Post: 02-16-2008, 04:13 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •