Hi,
I am writing a program that has 3 files:
File 1: One.java
File 2: abstract1.java
File 3: child.java
Child is a subclass of abstract1 and abstract1 is an abstract class.
I am trying to call a method in the Child class from One.java .
Currently i have this:
One.java
public class One
{
public static void main (String[] args)
{
int side=5;
abstract1 cir = new child();
child.child(side);
}
}
abstract1.java
public abstract class abstract1
{
public abstract void computeArea();
}
child.java
public class child extends abstract1
{
int side;
public child(int side1)
{
side=side1;
System.out.println("Hi"+side);
}
public void computeArea()
{
int area;
area = side * side;
}
}
The problem is that when i compile, it get the following errors:
One.java:
For the line, abstract1 cir = new child(); :
Cannot find symbol
symbol: constructor child()
location: class child
For the line ,child.child(side); :
Cannot find symbol
symbol: method child (int)
location: class child
So im not sure how to properly instantiate the Child class in the first place, and then how to call a method after.
Thanks