How can I use the variable drawMax in a different class?
public int DrawNumberSetting (int drawMax)
{
System.out.print ("Please enter the maximum number of draws you want to play: ");
drawMax = scan.nextInt ();
return drawMax;
}
How can I use the variable drawMax in a different class?
public int DrawNumberSetting (int drawMax)
{
System.out.print ("Please enter the maximum number of draws you want to play: ");
drawMax = scan.nextInt ();
return drawMax;
}
You can turn drawMax into a class level variable and provide a getter\accessor method, like this:
private int drawMax;
public void DrawNumberSetting ()
{
System.out.print ("Please enter the maximum number of draws you want to play: ");
drawMax = scan.nextInt ();
}
public int getDrawMax()
{
return drawMax;
}