Overloading in JAVA

Method Overloading and Constructor Overloading

/* 
Create Class Student with attributes like rollno and name, where You have to implement the concept of Method Overloading and Constructor Overloading.

Constructor Overloading and Static member concept :
Create Constructor in such a way where if User provide (rollno, name) then students object should be created with same. If user provide only name then next possible rollno should be assigned to student. 

Method Overloading :
Create method exam where marks of 3 subject will be supplied. If student get <50 marks in any of the subject then result should be declared as a Fail with no of ATKT in a exam.
If students appeared in exam of only one or two subject then using appropriate method should be called with different no of parameters 
*/


class Student
{
                int rollno;
                String name;
                static int noofstud;

// Constructor Overloading
                Student()
                {
                }

                Student(int roll,String sname)
                {
                                this.rollno=roll;
                                this.name=sname;
                                noofstud=roll+1;
                }
                Student(String sname)
                {
                                this.rollno=noofstud;
                                this.name=sname;
                }

//Method Overloading
                void exam(int sub1,int sub2,int sub3)
                {
                                int fail=0;
                                if(sub1<50)
                                {
                                                fail=fail+1;
                                }

                                if(sub2<50)
                                {
                                                fail=fail+1;
                                }

                                if(sub3<50)
                                {
                                                fail=fail+1;
                                }

                                if(fail==0)
                                {
                                                System.out.println("Congratulations "+ this.name + " You have successfully clear the Exam.....!");
                                }
                                else
                                {
                                                System.out.println("Sorry "+ this.name + " You are failed in "+fail+" Subject");
                                }
                }

                void exam(int sub1,int sub2)
                {
                                exam(sub1,sub2,0);
                }

                void exam(int sub1)
                {
                                exam(sub1,0,0);
                }

                public static void main(String args[])
                {
                                Student s1=new Student(1,"Ajay");
                                Student s2=new Student("Mitesh");
                                Student s3=new Student("Mitesh");
                                                               
                                s1.exam(50,60,12);
                                s2.exam(60,70);
                                s3.exam(30);
                }

}