0
Help me one dimension array im new learning java
Student class is defined as follows. Class Student {int Number String Name} Using the “Student” class write a Java program that reads student’s data on the screen into one dimension array. List the data that you red in array. Test your program for 10 students and show the result list
4 ответов
+ 3
Hint : Create Array of 10 objects to Student class. Take input and print what you taken.
+ 2
How about you try it by yourself?
If you show your attempt and find any problem we will help you.
+ 1
Hasan Aydın
If you write code in answer, then save code in playground and share link here. Hoping looking at farmat, you copy pasted i think. So you have lot of errors.. Some of which :
1) you are capital letters in place of small in import, public, student,...
2. You forgot semicolon after Scanner object statement.
3) you are not using double quotes.. Use " instead of “
4) you are not closing last print statement properly...
Try these edits...
0
where is the problem this code
İmport java.util.*;
Public class Main {
public static void main (String [] args) {
try {Scanner reader = new Scanner (System.in) ) {
Student array[] = new student [10];
for (int i=0; i<10; i++)
System.out.print1n(“Enter student number:
“);
int num =
Integer. parseInt(reader.next () ) ;
System.out.print1n(“Enter student number:
“);
String name = reader.next () ;
array[i] = new Student () ;
array[i].Name=name;
array[i]Number = num;
}
for (int i=0; i<10; i++) {
System.out.print1n( “Student number: “+
array[i].Number +” Student Name: “ + array[i].Name + “\n”;
}
}
}
}