class Main{
public void sum(){
int i=5;
int j=6;
int s=i+j;
System.out.println("Sum of the two numbers :
"+s);
}
public void mult(int a, int b){
int c;
int d;
c=a;
d=b;
int mult=c*d;
System.out.println("Multiplication of two numbers :
"+mult);
}
public static void main(String args[]){
Main obj1=new Main();
Main obj2=new Main();
obj1.sum();
obj2.mult(5,4);
}
}
OUTPUT:-
C:\Users\Satyendra\Desktop>javac
1.java
C:\Users\Satyendra\Desktop>java Main
Sum of the two numbers : 11
Multiplication of two numbers : 20
No comments:
Post a Comment