taskof overloading

PHOTO EMBED

Thu Dec 21 2023 14:43:27 GMT+0000 (Coordinated Universal Time)

Saved by @user01

import java.util.*;
class student{
	int a,b,c,sum,diff,mul;
	student(int a , int b){
		this.a = a;
		this.b = b;
		sum = a+b;
		System.out.println(sum);
	}
	student(int a,int b,int c){
		this.a = a;
		this.b = b;
		this.c = c;
		sum = a+b+c;
		System.out.println(sum);
	}
	void students(int a,int b){
		this.a = a;
		this.b = b;
		diff = a - b;
		System.out.println(diff);
	}
	void students(int a,int b){
		this.a = a;
		this.b = b;
		mul = a*b;
		System.out.println(mul);
	}
}
class studentTest{
	public static void main(String[]args){
		student s1 = new student(5,6);
		student s2 = new student(4,5,6);
		s1.student(4,2);
		s2.student(2,3,6);
	}
}	
content_copyCOPY