zoukankan      html  css  js  c++  java
  • 算法Sedgewick第四版-第1章基础-019一Scanner的用法

     1 package algorithms.fundamentals001;
     2 
     3 import java.util.Locale;
     4 import java.util.Scanner;
     5 
     6 import algorithms.util.StdIn;
     7 
     8 public class IsEquals {
     9 
    10     // assume Unicode UTF-8 encoding
    11     private static final String CHARSET_NAME = "UTF-8";
    12 
    13     // assume language = English, country = US for consistency with System.out.
    14     private static final Locale LOCALE = Locale.US;
    15     
    16     private static Scanner scanner;
    17     // do this once when StdIn is initialized
    18     static {
    19         resync();
    20     }
    21     /**
    22      * If StdIn changes, use this to reinitialize the scanner.
    23      */
    24     private static void resync() {
    25         setScanner(new Scanner(new java.io.BufferedInputStream(System.in), CHARSET_NAME));
    26     }
    27     
    28     private static void setScanner(Scanner scanner) {
    29         IsEquals.scanner = scanner;
    30         IsEquals.scanner.useLocale(LOCALE);
    31     }
    32     
    33     public static void main(String[] args) {
    34 //        int a = scanner.nextInt();
    35 //        int b = scanner.nextInt();
    36 //        int c = scanner.nextInt();
    37 //        System.out.println(a==b && b==c);
    38         double a = scanner.nextDouble();
    39         double b = scanner.nextDouble();
    40         System.out.println((a > 0.0 && a < 1.0) && (b > 0.0 && b < 1.0));
    41     }
    42 }
  • 相关阅读:
    re | [SWPU2019]ReverseMe
    wp | re | 2020“巅峰极客”网络安全技能挑战赛
    re | [CFI-CTF 2018]IntroToPE
    re | [FlareOn1]Bob Doge
    re | [ACTF新生赛2020]SoulLike
    re | [GKCTF2020]Chelly's identity
    ospf配置与ofps选举DR/BDR
    静态路由的配置
    配置三层交换机实现vlan间通信
    hybrid接口
  • 原文地址:https://www.cnblogs.com/shamgod/p/5411533.html
Copyright © 2011-2022 走看看