0

this is the program i wrote i just want to take the user input of length and breadth in this program what shod i do to take user input. i had tried this but have no idea now how to take input in getter and setter :

public class Area{

    int a,c;  // length and breadth
    
    Area(int l, int b){
        a = l;
        c = b;
    }

    public int setDim(){
        int results = a * c;
        return results;
    }
    
    public void getArea(){
        System.out.println("Area = " +  setDim());
    }

    public static void main(String []args){
        Area x =new Area(6,5);
        x.getArea();
    }
}
Giorgi Tsiklauri
  • 9,715
  • 8
  • 45
  • 66
aann aann
  • 1
  • 1

0 Answers0