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

57 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. Awesome post. Really you are shared very informative concept... Thank you for sharing. Keep on
    updating...

    datesheet-nic
    Education

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

    ReplyDelete
  10. 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
  11. 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
  12. Nicely explaned thanks for sharing..keep posting such a amazing post.
    MOVIES4YOU
    Dil Bechara Full movie Donload

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

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

    ReplyDelete
  16. 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
  17. 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
  18. 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
  19. I want to say thanks to you. I have bookmark your site for future updates.
    data scientist certification malaysia

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

    ReplyDelete
  21. 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
  22. Trading Software That Automatically Makes You Money. Mobile Forex Trading Is The First And Only Trading Platform That Automatically Makes You Money With Little To No Effort On Your Part. Developed By A Team Of Mathematicians, Stock Market Professionals, And Computer Scientists, Mobile Forex Trading Is Guaranteed To Make You A Consistent Income, Even While You Sleep.

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

    ReplyDelete
  24. 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
  25. 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
  26. 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
  27. 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

  28. 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
  29. Thank you for this important information it contains very good knowledge and helps me a lot Best CBSE School in Faridabad

    ReplyDelete
  30. 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
  31. Oh my goodness! Impressive article dude! Thanks, PLease Check my article also.

    Mod Apk and Games

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

    Seekhlo Tech

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

    Best SaaS Development Company

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

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

    ReplyDelete
  36. 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