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]); } } }
2 odpowiedzi
+ 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!!!🙂
+ 1
It can work now,thanks you!