Untitled

 avatar
unknown
plain_text
2 years ago
1.1 kB
8
Indexable
import java.util.*;

public class StudentInfo{
	public static void main(String[] args){

	StudentInfo[] stdinfo = new StudentInfo[5];

	stdinfo[0] = new StudentInfo("Aisyah","100");
	stdinfo[1] = new StudentInfo("Auni","200");
	stdinfo[2] = new StudentInfo("Atika","300");
	stdinfo[3] = new StudentInfo("Aliah","400");
	stdinfo[4] = new StudentInfo("Iman","500");
    
    System.out.println("Product Object 1:");  
	stdinfo[0].display(); 
    
    System.out.println("Product Object 1:");  
	stdinfo[1].display();  

	System.out.println("Product Object 1:");  
	stdinfo[2].display();  

	System.out.println("Product Object 1:");  
	stdinfo[3].display();  

	System.out.println("Product Object 1:");  
	stdinfo[4].display();  
	}
}
class StudentInfo{
    String stdninfo_id;
    String stdninfo_name;
        
    StudentInfo(String sid, String n){
      	stdninfo_name = n;
        stdninfo_id = sid;
        }  
    
    public void display(){
    	System.out.print("Student Id = "+stdninfo_Id + "  " + " Student Name 		= "+stdn_name);  
		System.out.println(); 
    }  
}
Editor is loading...