Help me one dimension array im new learning java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

29th Nov 2020, 1:35 PM
Hasan Aydın
Hasan Aydın - avatar
4 Answers
+ 3
Hint : Create Array of 10 objects to Student class. Take input and print what you taken.
29th Nov 2020, 3:18 PM
Jayakrishna 🇮🇳
+ 2
How about you try it by yourself? If you show your attempt and find any problem we will help you.
29th Nov 2020, 2:00 PM
The future is now thanks to science
The future is now thanks to science - avatar
+ 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...
29th Nov 2020, 6:38 PM
Jayakrishna 🇮🇳
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”; } } } }
29th Nov 2020, 6:04 PM
Hasan Aydın
Hasan Aydın - avatar