Monday 14 April 2014

JAVA Programs To Implement Designing Package With JAVA Package


Write A JAVA Programs To Implement Designing Package With JAVA Package

Ex: No: 11 DESIGNING PACKAGE WITH JAVA PACKAGE

Aim:To write a JAVA programs to implement designing package with JAVA package

Algorithms:

Step 1: Start the program.
Step 2: Create a package called name which contains the class addition with member function to perform addition operation.
Step 3: Impact the created package in the main class.
Step 4: From the main class make a function call to the package.
Step 5: Display the resultant values.
Step 6: Stop the program.


Programs:

package eee;
import java.io.*;
public class addition
{
int a,b,c;
public void add(int a,int b)
{
c=a+b;
System.out.println("sum is"+c);
}
}
import java.io.*;
//import eee.addition;
class sum
{
public static void main(String args[])
{
addition d1=new addition();
d1.add(80,20);
}
}

Output:
Sum is 100

Result:
Thus the implementation of JAVA program for Designing package with JAVA package EEE is executed and the output has been verified.


0 comments:

Post a Comment