Hello everyone,
My problem is I need to let the user enter the dimensions of the array at runtime and use loops to fill the array with random number from 50 to 150. I must the random() method.
Someone please help, I am a beginner! This is what I have so far.
import java.util.Random;
public class ArrayTA
{
public static void main(String [] args)
{
Random random = new Random();
System.out.print("Enter the length of the row: ");
int x = SavitchIn.readLineInt();
System.out.print("Enter the length of the row: ");
int y = SavitchIn.readLineInt();
double [][]myDoubles;
myDoubles = new double [x][y];
Also don't forget that integers are primitives, and not objects. So to add an integer to a vector, you'd have to use vector.addElement(new Integer(...)) rather than vector.addElement(...)