Using Methods That Take Parameters - Java Object Oriented Design

Java examples for Object Oriented Design:Method

Description

Using Methods That Take Parameters

Demo Code

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;
    }
}

Related Tutorials