0

Could you help me to improve my program? I am in trouble to make an Array and Random program🙏🙏🙏

import java.util.Random; import java.util.Scanner; public class Program { public static void main(String[] args) { Random rand = new Randam(); Scanner input=new Scanner(System.in); int n=input.nextInt(); int a[]=new int[n]; for(int i=0;i<n;i++){ a[i]=1 + rand.nextInt(10); System.out.println("a[" + i + "] = " + a[i]); } } }

20th Jun 2018, 12:40 AM
Hunt
Hunt - avatar
2 ответов
+ 5
It appears your issue may be a spelling or typing error. Random Rand = new Random the 2nd random needs a o not a. Hope this helps!!!🙂
20th Jun 2018, 1:38 AM
bobbie
bobbie - avatar
+ 1
It can work now,thanks you!
20th Jun 2018, 4:22 AM
Hunt
Hunt - avatar