Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- interface shape{
- int length=3,breadth=6,side = 6;
- void AreaOfSqure();
- void AreaOfRectangle();
- }
- class Main implements shape{
- public void AreaOfSqure(){
- System.out.println("Area of Square is " +side*side);
- }
- public void AreaOfRectangle(){
- System.out.println("Area of Rectangle is " + length*breadth);
- }
- public static void main (String args[]){
- Main obj = new Main();
- obj.AreaOfRectangle();
- obj.AreaOfSqure();
- }
- }
- /*
- Area of Rectangle is 18
- Area of Square is 36
- */
Add Comment
Please, Sign In to add comment