OneCompiler

What is class

188

import java.util.*;
public class Student{ //Class
String name;
Integer id;
public static void main(String args[]){
Student s1=new Student();
s1.name="Amanvfjndffdg"; //thesse are objects
s1.id=1; //thesse are objects
Student s2=new Student(); //Here Student() is a constructer
s2.name="Amadfdfjn"; //thesse are objects
s2.id=1344; //thesse are objects
Student s3=new Student();
s3.name="Afjfhjfman"; //thesse are objects
s3.id=4483123; //thesse are objects
System.out.println(s1.name);
System.out.println(s1.id);
System.out.println(s2.name);
System.out.println(s2.id);
System.out.println(s3.name);
System.out.println(s3.id);
}
}