Algorithm Sedgewick Fourth Edition-1th Chapter Basics-Usage of 191 scanner

Source: Internet
Author: User
Tags locale stdin

1  Packagealgorithms.fundamentals001;2 3 ImportJava.util.Locale;4 ImportJava.util.Scanner;5 6 Importalgorithms.util.StdIn;7 8  Public classIsequals {9 Ten     //assume Unicode UTF-8 encoding One     Private Static FinalString charset_name = "UTF-8"; A  -     //Assume language = 中文版, country = US for consistency with System.out. -     Private Static FinalLocale locale =locale.us; the      -     Private StaticScanner Scanner; -     //Do the once when StdIn is initialized -     Static { + Resync (); -     } +     /** A * If StdIn changes, use this to reinitialize the scanner. at      */ -     Private Static voidResync () { -Setscanner (NewScanner (NewJava.io.BufferedInputStream (system.in), charset_name)); -     } -      -     Private Static voidSetscanner (Scanner Scanner) { inIsequals.scanner =scanner; - IsEquals.scanner.useLocale (LOCALE); to     } +      -      Public Static voidMain (string[] args) { the //int a = Scanner.nextint (); * //int b = Scanner.nextint (); $ //int c = Scanner.nextint ();Panax Notoginseng //System.out.println (a==b && b==c); -         DoubleA =scanner.nextdouble (); the         Doubleb =scanner.nextdouble (); +System.out.println (A > 0.0 && a < 1.0) && (b > 0.0 && B < 1.0)); A     } the}

Algorithm Sedgewick Fourth Edition-1th Chapter Basics-Usage of 191 scanner

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.