Computer Science, asked by kanupriya163, 8 months ago

write a class to calculate and print area of a square and area of a rectangle. input required data using scanner class.

no spam otherwise will be reported​. you have to write a Java program which should be suitable for class 9 student. if you don't know, don't reply


Anonymous: hi

Answers

Answered by sagarmohanty
1

Answer:

import java.util.*;

class square{

int a,b;

void area(){

System.out.println(a*b);

}

public static void main(String args){

Scanner sc = new Scanner(System.in);

area s = new area();

s.a = sc.nextInt();

s.b = sc.nextInt();

s.area()

}

}

Similar questions