import java.util.Scanner;
public class GradePointAverage {
public static void main(String[] args) {
Scanner peace = new Scanner(System.in);
System.out.print("How many subjects do you want to enter?: ");
int a=peace.nextInt();
String[] b = new String[a];
for(int i=0;i<a;i++) {
b[i]="";
System.out.print("Enter Subject No "+(i+1)+" ");
String c=peace.next();
}
for(i=0;i<b.length;i++) {
System.out.print(b[i]);
}
}
}
Greetings. :) We have a programming experiment and well I was stuck in this part. I need to ask the user how many subjects he wants to enter and ask the user to input the subjects. I think I already entered the subjects on the array but when i want to see the content of the array it won't give me my desired output, the subjects i entered won't appear. Please help, I'm new here on this site and it's my first time to ask a question on a forum like this. Hoping that someone would reply. Thanks.
String c = peace.next();withb[i] = peace.nextLine();a,b,c, butsubjectsNumber,subjects,subjectsName.