Sunday, October 21, 2012

Java program to create user defined exception handling


import java.io.*;
class myException extends Exception
{ myException()
  { System.out.println("Error:Password too short");
  }
  myException(int n)
  { System.out.println("Error:Only adults can join");
  }
}
class user_exception
{ public static void main(String s[])throws IOException,myException
  { BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    try
    { System.out.print("Enter user name : ");
      String n=br.readLine();
      System.out.print("Enter your password : ");
      String m=br.readLine();
      if(m.length() <6)
        throw new myException();
      System.out.print("Enter your age : ");
      int o=Integer.parseInt(br.readLine());
      if(o<18)
        throw new myException(o);
    }
    catch(Exception e)
    {    }
  }
}   
Output

58 comments:

  1. Helpful to create user defined function in java ..java training in chennai

    ReplyDelete
  2. This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.
    Click here:
    angularjs training in rajajinagar
    Click here:
    angularjs training in marathahalli

    ReplyDelete
  3. Just stumbled across your blog and was instantly amazed with all the useful information that is on it. Great post, just what i was looking for and i am looking forward to reading your other posts soon!
    Click here:
    Microsoft azure training in sollinganallur
    Click here:
    Microsoft azure training in btm

    ReplyDelete
  4. I would like to thank you for your nicely written post, its informative and your writing style encouraged me to read it till end. Thanks

    java training in annanagar | java training in chennai

    java training in chennai | java training in electronic city

    ReplyDelete
  5. I am obliged to you for sharing this piece of information here and updating us with your resourceful guidance. Hope this might benefit many learners. Keep sharing this gainful articles and continue updating us.
    Software Testing Training in Chennai
    Software Testing Courses in Chennai
    Software Training Institutes in Chennai
    Software Testing Training Institutes in Chennai
    Software Testing Course

    ReplyDelete
  6. Its a good post and keep posting good article.its very interesting to read.
    Best Selenium Training Institute in Chennai | Selenium Course in Chennai

    ReplyDelete
  7. I was recommended this web site by means of my cousin. I am now not certain whether this post is written through him as nobody else recognise such precise about my difficulty. You're amazing! Thank you!
    angularjs online training

    apache spark online training

    informatica mdm online training

    devops online training

    aws online training

    ReplyDelete
  8. Thank you for such information. Please keep up the good work.
    Python training in kalyan nagar

    ReplyDelete
  9. Nice article about Java Program... I was in search of such article... At last found this easy one.
    Earn Money Now without any effort

    ReplyDelete
  10. Good articles, Have you heard of LFDS (Le_Meridian Funding Service, Email: lfdsloans@outlook.com --WhatsApp Contact:+1-9893943740--lfdsloans@lemeridianfds.com) is as USA/UK funding service they grant me loan of $95,000.00 to launch my business and I have been paying them annually for two years now and I still have 2 years left although I enjoy working with them because they are genuine Loan lender who can give you any kind of loan.

    ReplyDelete
  11. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...data science courses

    ReplyDelete
  12. I truly appreciate essentially perusing the entirety of your weblogs. Basically needed to advise you that you have individuals like me who value your work. Certainly an extraordinary post. Caps off to you! The data that you have given is useful.
    data scientist training and placement

    ReplyDelete
  13. 매우 유용한 데이터를 제공합니다. 이 게시물은 나에게 매우 유용하다는 많은 조언을 제공합니다. 몇 가지 문제를 해결하는 데 큰 도움이됩니다. 유용한 기사를 공유해 주셔서 대단히 감사합니다.
    내 사이트를 방문하십시오.파워볼사이트
    많은 정보를 얻을 수 있습니다.

    ReplyDelete
  14. Title:
    Big Data Training in Chennai | Infycle Technologies

    Description:
    Are you looking for Big Data training in Chennai with placement opportunities? Then we, Infycle Technologies are with you to make your dream into reality. Infycle Technologies is one of the best Big Data Training Institute in Chennai, which offers various programs along with Big Data such as Oracle, Java, AWS, Hadoop, etc., in complete hands-on practical training with trainers, those are specialists in the field. In addition to the training, the mock interviews will be arranged for the candidates, so that they can face the interviews with the best knowledge. Of all that, 100% placement assurance will be given here. To have the words above in the real world, call 7502633633 to Infycle Technologies and grab a free demo to know more.
    Best aws traiining in Chennai

    ReplyDelete
  15. UNIQUE ACADEMY FOR COMMERCE, an institute where students enter to learn and leave as invincible professionals is highly known for the coaching for CA and CS aspirants.

    cs executive
    freecseetvideolectures/
    UNIQUE ACADEMY

    ReplyDelete
  16. Are you looking for Big Data training in Chennai with placement opportunities? Then we, Infycle Technologies are with you to make your dream into reality. Infycle Technologies is one of the best Big Data Training Institute in Chennai, which offers various programs along with Big Data such as Oracle, Java, AWS, Hadoop, etc., in complete hands-on practical training with trainers, those are specialists in the field. In addition to the training, the mock interviews will be arranged for the candidates, so that they can face the interviews with the best knowledge. Of all that, 100% placement assurance will be given here. To have the words above in the real world, call 7502633633 to Infycle Technologies and grab a free demo to know more.
    BEST SOFTWARE TRAINING IN CHENNAI

    ReplyDelete
  17. I want to say thanks to you. I have bookmark your site for future updates.
    data scientist certification malaysia

    ReplyDelete
  18. Your OctaFx Review Account Allows You To Login To Your Account In More Than 1 Country.

    ReplyDelete
  19. Thanks for sharing this information. I really like your blog post very much. You have really shared a informative and interesting blog post with people..
    data science course fee in hyderabad

    ReplyDelete
  20. Hi buddies, it is a great written piece entirely defined, continuing the good work constantly.
    data science classes in hyderabad

    ReplyDelete
  21. If you're looking for help in using it, just dial Quickbooks Customer Service +1 855-675-3194 to speak with a live representative.

    ReplyDelete
  22. When you or your company need help with QuickBooks or any other aspect of your business, dial Quickbooks Support Phone Number +1 888-210-4052.

    ReplyDelete
  23. Just dial Quickbooks Customer Service +1 888-210-4052 for quick assistance. The people behind the QuickBooks support phone number provide quick and accurate answers to any problem with your QuickBooks.

    ReplyDelete
  24. I read your blog its nice i like content its very useful for me
    QuickBooks error support helps to resolve yours problem regarding QuickBooks support .Our Company have l15 year experience to solve all QuickBooks error. Our team very hardworking.
    ND files in QuickBooks desktop

    ReplyDelete

  25. What a wonderful information it really helps me a lot to understand new things also have a look on this School with best rating.

    ReplyDelete
  26. Thank you for this important information it contains very good knowledge and helps me a lot Best CBSE School in Faridabad

    ReplyDelete
  27. HELLO, THANK YOU FOR VISITING MY BLOG.

    ENJOYED READING MY ARTICLE?

    kindly Support by sharing this and making donation to :

    BITCOIN : bc1qgkncx8pfu24cn8gzf4wpqv7fk5v0nvp4wm95pk

    ETHER: 0x14e41D03e09Af44EeF505bb265C616075B5b668b

    SHIBA INU: 0x14e41D03e09Af44EeF505bb265C616075B5b668b

    BTT: 0x14e41D03e09Af44EeF505bb265C616075B5b668b


    OTHER CURRENCY TO OUR MULTI COIN WALLET :0x14e41D03e09Af44EeF505bb265C616075B5b668b

    ReplyDelete
  28. Oh my goodness! Impressive article dude! Thanks, PLease Check my article also.

    Mod Apk and Games

    ReplyDelete
  29. Oh my goodness! Impressive article dude! Thanks, PLease Check my article also.

    Seekhlo Tech

    ReplyDelete
  30. Thanks a lot for giving us such helpful information.

    Best SaaS Development Company

    ReplyDelete
  31. Once again thanks for sharing your knowledge among the needful ones.
    it course center in chennai

    ReplyDelete
  32. This is such a great post, and was thinking much the same myself. Shillong Teer Previous Result

    ReplyDelete
  33. Active Detailing Franchise invites aspiring entrepreneurs to join our network and become part of a brand that values innovation, quality, and a commitment to exceeding customer expectations.

    ReplyDelete
  34. Safety barriers are installed in areas where hazards may occur, keeping the environment safe where vehicles, goods, and people move. It is an important protective measure for road safety and factory safety. So how do you choose a reliable safety barrier product? A lot depends on a reliable safety barrier manufacturer. In today’s guide, we’ll introduce you to 10 reliable Security barrier manufacturers in the United States. Read on to learn more.

    ReplyDelete
  35. Active Detailing excels in delivering top-tier Paint protection film services in Noida and Indirapuram.

    ReplyDelete
  36. This blog post on creating user-defined exceptions in Java provides an excellent breakdown of a crucial concept for Java developers. Understanding how to define and handle custom exceptions is essential for building robust applications, especially in complex projects where generic exceptions aren’t descriptive enough. For those interested in enhancing their technical skills in Java and digital marketing, our Digital Marketing Course In Delhi covers a range of foundational and advanced topics. This course can be beneficial for those aiming to expand their career into digital domains while keeping their programming skills relevant in today’s tech-driven marketing landscape.

    ReplyDelete
  37. The search for a dream home often revolves around three essential factors: location, comfort, and amenities. Exotica Dreamville , located in the heart of Sector 16C, Noida Extension, ticks all these boxes and more. With ready-to-move-in 2/3 BHK apartments, this project offers an ideal living space for families seeking a blend of luxury and functionality.

    ReplyDelete