What is the java equivalent of the following C code.
for(i = 0;i<n;i++)
scanf("%d",&a[i])
where i is a previously defined integer and a is an array
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The scanner class is used,
System.inis the standard input, but it can get other input streams:Anyway, this might cause you some problems if the user press enter between two numbers, so another approach will be: