JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.util.Arrays;
public class Student{
int student_id,student_marks;
public static void main(String[] args) {
Student s1=new Student(101,60) ;
Student s2=new Student(102,40) ;
Student[] students=new Student[2] ;
students[0] =s1;
students[1] =s2;
System.out.println(Arrays.toString(students));
}
Student(int id,int marks) {
student_id=id;
student_marks=marks;
}
public String toString(){
return "[id:"+student_id+"->" +"marks:"+student_marks+"]";
}
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run