Package java.util

Examples of java.util.Scanner.nextInt()


            sc.nextLine();
        }
        mspdata.betweenMeetingsDistance = new int[mspdata.numberOfMeetings][mspdata.numberOfMeetings];
        for (int i = 0; i < mspdata.numberOfMeetings; i++) {
            for (int j = 0; j < mspdata.numberOfMeetings; j++) {
                mspdata.betweenMeetingsDistance[i][j] = sc.nextInt();
            }
            sc.nextLine();
        }
        sc.close();
        return mspdata;
View Full Code Here


     * @throws DataReadException
     */
    public ArrayList<Long> readArrayOfLong(BufferedReader reader) throws DataReadException {
        Scanner scanner = new Scanner(reader);
        if (scanner.hasNextInt()) {
            int size = scanner.nextInt();
            ArrayList<Long> array = new ArrayList<Long>();
            for (int i = 0; i < size; ++i) {
                if (scanner.hasNextLong()) {
                    array.add(new Long(scanner.nextLong()));
                } else {
View Full Code Here

     * @throws DataReadException
     */
    public ArrayList<Double> readArrayOfDouble(BufferedReader reader) throws DataReadException {
        Scanner scanner = new Scanner(reader);
        if (scanner.hasNextInt()) {
            int size = scanner.nextInt();
            ArrayList<Double> array = new ArrayList<Double>();
            for (int i = 0; i < size; ++i) {
                if (scanner.hasNextDouble()) {
                    array.add(new Double(scanner.nextDouble()));
                } else {
View Full Code Here

     * @throws DataReadException
     */
    public ArrayList<String> readArrayOfString(BufferedReader reader) throws DataReadException {
        Scanner scanner = new Scanner(reader);
        if (scanner.hasNextInt()) {
            int size = scanner.nextInt();
            ArrayList<String> array = new ArrayList<String>();
            for (int i = 0; i < size; ++i) {
                if (scanner.hasNextLine()) {
                    array.add(scanner.nextLine());
                } else {
View Full Code Here

    Scanner in = new Scanner(System.in);
    int year, month, day;
    MyDate next = new MyDate();
    MyDate previous = new MyDate();
    try {
      year = in.nextInt();
      month = in.nextInt();
      day = in.nextInt();
    } catch (Exception e) {
      System.out.println("请输入正确的数字");
      return;
View Full Code Here

    int year, month, day;
    MyDate next = new MyDate();
    MyDate previous = new MyDate();
    try {
      year = in.nextInt();
      month = in.nextInt();
      day = in.nextInt();
    } catch (Exception e) {
      System.out.println("请输入正确的数字");
      return;
    }
View Full Code Here

    MyDate next = new MyDate();
    MyDate previous = new MyDate();
    try {
      year = in.nextInt();
      month = in.nextInt();
      day = in.nextInt();
    } catch (Exception e) {
      System.out.println("请输入正确的数字");
      return;
    }
    if (!isCorrect(year, month, day)) {
View Full Code Here

  public MyDate getInput() {
    Scanner in = new Scanner(System.in);
    MyDate myDate = new MyDate();
    try {
      myDate.setYear(in.nextInt());
      myDate.setMonth(in.nextInt());
      myDate.setDay(in.nextInt());
    } catch (Exception e) {
      System.out.println("请输入正确的数字");
      return null;
View Full Code Here

  public MyDate getInput() {
    Scanner in = new Scanner(System.in);
    MyDate myDate = new MyDate();
    try {
      myDate.setYear(in.nextInt());
      myDate.setMonth(in.nextInt());
      myDate.setDay(in.nextInt());
    } catch (Exception e) {
      System.out.println("请输入正确的数字");
      return null;
    }
View Full Code Here

    Scanner in = new Scanner(System.in);
    MyDate myDate = new MyDate();
    try {
      myDate.setYear(in.nextInt());
      myDate.setMonth(in.nextInt());
      myDate.setDay(in.nextInt());
    } catch (Exception e) {
      System.out.println("请输入正确的数字");
      return null;
    }
    return myDate;
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.