Professional Documents
Culture Documents
Exp-2 Internet Programming
Exp-2 Internet Programming
Exp-2 Internet Programming
2. Steps involved
I. Create a class called ‘PrimeNumber’
Create different methods that will return various datatypes of numbers such as int,
float, double, short
The methods will have same name printn but different parameters
Create your main method
Give the corresponding values
Then compile using javac
Get the output
II. Create a class
Give two methods with same name but different parameters list
Create your main method
Print the output
FLOWCHART
Task-1
Task-2
3. Code for experiment/practical:
1.
class PrintNumber{
public int printn(int a){ // method overloading
return a;
}
public int printn(double b){ // same name function with different
parameters
return b;
}
ii)
class AreaShape{ //first Method
public int area (int side){
return(side*side);}
public int area (int length, int breadth){ //Second method with same name
return(length*breadth);
}
}
Public class Areas{
Public static void main(String[]args){ //main method
AreaShape a=new AreaShape();
System.out.println(“The Area of Square is: “ +n.area(6));
System.out.println(“The Area of Rectangle is: “ +n.areat(2,8));
}
}
4. Result/Output/Writing Summary:
1
2)
Evaluation Grid: