Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Nested try blocks

  1. #1
    Junior Member
    Join Date
    Apr 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Nested try blocks

    help me to create this thing i want the code pleaz


  2. #2
    Member
    Join Date
    Apr 2010
    Location
    The Hague, Netherlands
    Posts
    91
    Thanks
    3
    Thanked 10 Times in 10 Posts

    Default Re: Nested try blocks

    Yeah.. ask it in the forum called "Member Introductions".

    Also I don't think anyone wants to help, because if you open a webbrowser and go to google and just type in "Java try block" you get all sorts of results, but if youre that lazy to not even do that, then its youre bad luck.

  3. #3
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Nested try blocks

    Hello Ahmed,

    Welcome to the forums.

    Have you started to write any code? If so, please post what you have and we can see if you are doing it right.

    A quick example would be like this:

    class Nested_Try
    {
        public static void main (String args [ ] )
        {
            try
            {
                int a = Integer.parseInt (args [0]);
                int b = Integer.parseInt (args [1]);
                int quot = 0;
     
                try
                {
                    quot = a / b;
                    System.out.println(quot);
                }
                catch (ArithmeticException e)
                {
                    System.out.println("divide by zero");
                }
            }
            catch (NumberFormatException e)
            {
                System.out.println ("Incorrect argument type");
            }
        }
    }
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

Similar Threads

  1. Equilateral Triangle Using nested for loop
    By uchizenmaru in forum Loops & Control Statements
    Replies: 2
    Last Post: January 14th, 2010, 10:01 PM
  2. how do i draw a shape with nested loops?
    By Kilowog in forum Loops & Control Statements
    Replies: 1
    Last Post: September 25th, 2009, 12:14 AM
  3. [SOLVED] Trouble with draw and fillRect in pyramid logic using nested loop
    By LiquidMetal in forum Loops & Control Statements
    Replies: 4
    Last Post: April 27th, 2009, 03:25 AM