import java.util.Scanner; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author User */ class Parent{ String Name; int id; String semister; String course_code; int Mark; Parent(String semister,String course_code){ this.semister=semister; this.course_code=course_code; //System.out.println(""); } Parent(String Name,int id){ this.Name=Name; this.id=id; //System.out.println(""); } Parent(Parent x,Parent y,int Mark){ this.semister=x.semister; this.course_code=x.course_code; this.Name=y.Name; this.id=y.id; this.Mark=Mark; System.out.println("Semister: "+semister+"\nCourse_code:"+course_code+"\nName:"+Name+"\nID:"+id+"\nMark:"+Mark); } } public class myMain { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int id[]=new int[5]; String Name[]=new String[5]; int Mark[]=new int[5]; String sem=sc.nextLine(); String code=sc.nextLine(); for (int i = 0; i <5; i++) { Name[i]=sc.nextLine(); id[i]=sc.nextInt(); Mark[i]=sc.nextInt(); sc.nextLine(); } Parent ob1=new Parent(sem,code); for (int i = 0; i < 5; i++) { Parent ob2=new Parent(Name[i],id[i]); Parent ob3=new Parent(ob1,ob2,Mark[i]); } } }