it is a multiple class package, using inheritance.
please and info would help me out.
this is my tester(main) class
package project1;
import java.util.Scanner;
public class Main{
public static void main(String[] args)
{
Hobby d1 = new Hobby(1000, "Warhammer", "Death");
System.out.println(d1);
}
}
This is the class that I have as the parent class
package project1;
public class Hobby
{
Hobby(int hoursplayed,String hobbyname,String HobbyType)
{
System.out.println(hoursplayed + hobbyname + HobbyType);
}
public int hoursplayed()
{
return hoursplayed();
}
public int hobbyname()
{
return hobbyname();
}
public int HobbyType()
{
return HobbyType();
}
}
this is the child class. For some reason in the public void Battle, I am getting a method error, the suggested fixed under eclipse dont really help me.
package project1;
/*
* This statement allows the Constructor in Hobby to be called.
*/
public class Warhammer extends Hobby
{
Warhammer(int hoursplayed, String hobbyname, String HobbyType) {
super(hoursplayed , hobbyname , HobbyType );
// TODO Auto-generated constructor stub
}
public void Battle()
{
System.out.println(super.gethoursplayed() + " " + super.gethobbyname()
+ super.gethobbyname()+ " for the Emperor");
}
}

New Topic/Question
Reply


MultiQuote






|