Package java.util

Examples of java.util.Scanner.nextShort()


    Scanner s = new Scanner (testStr);

    myHarness.check(s.hasNextByte (16), "hasNextByte(16)");
    myHarness.check(s.nextByte(16), 95, "nextByte is 95");
    myHarness.check(s.hasNextShort(16), "hasNextShort(16)");
    myHarness.check(s.nextShort(16), 32767, "nextShort is 32767");
    myHarness.check(s.hasNextInt(16), "hasNextInt(16)");
    myHarness.check(s.nextInt(16), 1329545071, "nextInt is 1329545071");
    myHarness.check(s.hasNextLong(16), "hasNextLong(16)");
    myHarness.check(s.nextLong(16), 69540603232238L, "nextLong is 69540603232238");
    myHarness.check(s.hasNextBigInteger(16), "hasNextBigInteger(16)");
View Full Code Here


    myHarness.check(s.radix(), 16, "radix was not set to 16");

    myHarness.check(s.hasNextByte (), "hasNextByte()");
    myHarness.check(s.nextByte(), 95, "nextByte is 95");
    myHarness.check(s.hasNextShort(), "hasNextShort()");
    myHarness.check(s.nextShort(), 32767, "nextShort is 32767");
    myHarness.check(s.hasNextInt(), "hasNextInt()");
    myHarness.check(s.nextInt(), 1329545071, "nextInt is 1329545071");
    myHarness.check(s.hasNextLong(), "hasNextLong()");
    myHarness.check(s.nextLong(), 69540603232238L, "nextLong is 69540603232238");
    myHarness.check(s.hasNextBigInteger(), "hasNextBigInteger()");
View Full Code Here

      Scanner s = new Scanner (aktFile);
      i = 0;
      while (s.hasNextShort ())
  {
    tmp = s.nextShort ();
    this.myHarness.check (tmp, numbers[i],
        "nextShort() -> " + tmp + " != " +
        numbers[i]);
    i++;
  }
View Full Code Here

    int workExperience;
   
    Scanner kb = new Scanner(System.in);
   
    System.out.print("Please enter your age and the number of years you have worked, separated by a space:  " );
    age = kb.nextShort();
    workExperience = kb.nextInt();
   
    System.out.print("Are you a student? (If Yes enter True, else enter False): ");
    isAStudent = kb.nextBoolean();
    //answer = kb.next();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.