Create a student class with name, roll number. Use a constructor to initialize and display the student details
class Student
{
String name;
int rollNo;
Student(String name,int rollNo)
{
this.name=name;
this.rollNo=rollNo;
}
void display()
{
System.out.println(name);
System.out.println(rollNo);
}
}
class Main
{
public static void main(String args[])
{
Student s1=new Student(“John”,101);
s1.diplay();
}
}