JavaApplication47.java - /* * To change this license...

This preview shows page 1 - 2 out of 2 pages.

/** To change this license header, choose License Headers in Project Properties.* To change this template file, choose Tools | Templates* and open the template in the editor.*/package javaapplication47;import java.lang.reflect.Array;import java.util.Random;import java.util.Scanner;import java.util.Arrays;/**** @author Computer*/public class JavaApplication47 {/*** @param args the command line arguments*/public static int inputInt(String mess, int min, int max) {Scanner input = new Scanner(System.in);while (true) {try {System.out.print(mess);String string = input.nextLine().trim();//string ure7437232#@3 int1234//check null or spaceif (string != null && !string.isEmpty()) {int number = Integer.parseInt(string);////number input in rangeif (number >= min && number <= max) {return number;} else {System.out.println("Please Enter in Range from " + min + "to " + max);System.err.println("Please Try Again!");}
End of preview. Want to read all 2 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Summer
Professor
NoProfessor
Tags
Natural number, Project Properties, public static int inputint, public class JavaApplication47

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture