Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

public class ex04 { public static void main(String[] args) throws IOException {

ID: 3611583 • Letter: P

Question

public class ex04
{
public static void main(String[] args) throws IOException
{
int total = 0;
int[] age = null;
String[] name = null;

age = new int[total];
name = new String[total];

int i = 0;
Scanner keyboard = new Scanner(System.in);



System.out.println("how many students are in yourclass:   ");
total = keyboard.nextInt();

for(i = 0; i < 3; ++i)
{
   System.out.println("[" + i+1 + "]" + " person's name :" );
   name[i] = keyboard.next();
  
System.out.println("[" + i+1 + "]" + " person'sage   :" );
   age[i] = keyboard.nextInt();
}

for(i = 0; i < 3; ++i)
{
   System.out.println("[" + i+1 + "] ?? ??????   " + name[i]+ "??? ???   "+ age[i]);
  

}
  
}
}

Explanation / Answer

/* Highlighted the changes in bold letters */ import java.io.*; import java.util.*; public class Ex04 { public static void main(String[] args) throws IOException { int total = 0; int[] age = null; String[] name = null; int i = 0; Scanner keyboard = new Scanner(System.in); System.out.println("how many students are in yourclass:   "); total = keyboard.nextInt(); age = new int[total]; name = new String[total]; for(i = 0; i