Jar package of the input data in the Java Console (to achieve the input of a class has been uploaded .. Please download)

Source: Internet
Author: User

/* <Br/> * to change this template, choose tools | templates <br/> * and open the template in the editor. <br/> */</P> <p> package COM. ndk. javainput; </P> <p> Import Java. util. break; <br/>/** <br/> * @ author ndk <br/> */<br/> public class input <br/> {</ p> <p> // non-negative int value <br/>/* <br/> * @ return an integer not less than zero <br/> * int Param = input. unsignedint (); <br/> */<br/> Public static int unsignedin T () <br/>{< br/> (;;) <br/>{< br/> try <br/> {<br/> transport SC = new partition (system. in); <br/> int A = SC. nextint (); </P> <p> if (a <0) <br/>{< br/> system. out. println ("your input format is incorrect !! /N enter "again"); <br/> continue; <br/>}< br/> else <br/>{< br/> return; <br/>}< br/> catch (exception ES) <br/>{< br/> system. out. println ("your input format is incorrect !! /N enter "again"); <br/> continue; <br/>}</P> <p> // an integer greater than zero <br/>/* <br/> *@ return <br/> * int Param = input. morezeroint (); <br/> */</P> <p> Public static int morezeroint () <br/>{< br/> (;;) <br/>{< br/> try <br/> {<br/> transport SC = new partition (system. in); <br/> int A = SC. nextint (); </P> <p> if (a <= 0) <br/>{< br/> system. out. println ("your input format is incorrect !! /N enter "again"); <br/> continue; <br/>}< br/> else <br/>{< br/> return; <br/>}< br/> catch (exception ES) <br/>{< br/> system. out. println ("your input format is incorrect !! /N enter "again"); <br/> continue; <br/>}</P> <p> Public static string inputstr () <br/>{< br/> (;;) <br/>{< br/> try <br/> {<br/> transport SC = new partition (system. in); <br/> string a = SC. next (); </P> <p> return a; </P> <p >}< br/> catch (exception es) <br/>{< br/> system. out. println ("your input format is incorrect !! /N enter "again"); <br/> continue; <br/>}</P> <p> Public static double unsigneddouble () <br/>{< br/> (;;) <br/>{< br/> try <br/> {<br/> transport SC = new partition (system. in); <br/> double A = SC. nextdouble (); </P> <p> if (a <= 0.0d )//? <Br/>{< br/> system. Out. println ("your input format is incorrect !! /N enter "again"); <br/> continue; <br/>}< br/> else <br/>{< br/> return; <br/>}< br/> catch (exception ES) <br/>{< br/> system. out. println ("your input format is incorrect !! /N enter "again"); <br/> continue; <br/>}</P> <p> Public static double morezerodouble () <br/>{< br/> (;;) <br/>{< br/> try <br/> {<br/> transport SC = new partition (system. in); <br/> double A = SC. nextdouble (); </P> <p> if (a <0.0d) <br/>{< br/> system. out. println ("your input format is incorrect !! /N enter "again"); <br/> continue; <br/>}< br/> else <br/>{< br/> return; <br/>}< br/> catch (exception ES) <br/>{< br/> system. out. println ("your input format is incorrect !! /N enter "again"); <br/> continue; <br/>}</P> <p >}< br/>

Method Summary

Static java. Lang. String inputstr ()

Static double morezerodouble ()

Static int morezeroint ()

Static double unsigneddouble ()

Static int unsignedint ()

If you have any questions, please contact me.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.