i dont understand the question from chapter 3: "working with java data types" excercise 2.
The question:
Create a TestClass that has a static variable of type Bird. Initialize this variable with a valid Bird object.
Print out the default values of static and instance variables of Bird from the main method ofTestClass.
Also print out the static variable of TestClass from main. Observe the output
below my code:
Code: Select all
public class Bird{
private boolean fly; // instance variable
private double speed; // instance variable
private float height; // instance variable
public static String name = "Sparrow"; // static class variable
public static int wings = 2; // static class variable
// instance method setter
public void isFly(){
this.fly = true;
}
public static void main(String [] args){
Bird bd = new Bird();
TestClass TC = new TestClass(bd);
}
}
class TestClass{
public static Bird secondBird;
public static void main (String [] args){
}
}
required: no arguments
found: Bird
reason: actual and formal argument lists differ in length
1 error
I dont understand why i'll get an error, because i'm using the constructor to initialize the static variabele while parsing an object Bird to the instance TC?
Tnx in advance!