Java examples for Object Oriented Design:Method
Using Methods That Take Parameters
public class ParameterScope{ public static void main(String[] args){ int min = 1; int max = 10; int number = getRandomNumber(min, max); System.out.println(number); }//from ww w .java 2s .com public static int getRandomNumber(int min, int max) { return (int)(Math.random() * (max - min + 1)) + min; } }