why i am getting these error in these code when trying to create object of square1
package practice;
import java.util.Scanner;
public class rectangle1 {
float length;
float breadth;
float area;
public void input() {
Scanner sc = new Scanner(System.in);
System.out.println("enter the length");
length=sc.nextFloat();
System.out.println("enter the breadth");
breadth=sc.nextFloat();
}
public void compute() {
area=length*breadth;
}
public void display() {
System.out.println(area);
}
class square1 extends rectangle1 {
float length;
float area;
public void input() {
Scanner sc = new Scanner(System.in);
System.out.println("enter the length");
length=sc.nextFloat();
}
public void compute() {
area=length*length;
}
}
class circle1 extends rectangle1 {
float pie=3.14f;
int r;
float area;
public void input() {
Scanner sc = new Scanner(System.in);
System.out.println("enter the radius");
r=sc.nextInt();
}
public void compute() {
area=pie*r*r;
}
}
class pol {
public void controlapp(rectangle1 ref) {
ref.input();
ref.compute();
ref.display();
}
}
public static void main(String[] args) {
rectangle1 obj=new rectangle1();
obj.input();
obj.compute();
obj.display();
square1 obj1=new square1();
}
}
I have tried all that I know but unable to find where I am going wrong
is it some thing I am missing with extends keyword or something?