I am writing a class (Suite) that is inheriting from another class (HotelRoom). The HotelRoom class has a constructor that requires an argument (an int) and so in the constructor for ...
Inheritance error? (Java in General forum at JavaRanch) A friendly place for programming greenhorns! Register / Login Java Forums Java Java in General Inheritance error? Post by: Kevin Tansey, Ranch Hand on Dec 11, 2005 17:03:00 I'm trying to call a method to get a value... but I'm not sure exactly how to do it! This is a small ...
Given: class A { protected int method1(int a, int b) { return 0; } } Which two are valid in a class that extends class A? (Choose two) A. public int method1(int a, int b) { return 0; } B. private int method1(int a, int b) { return 0; } C. private int method1(int a, long b) { return 0; } ...
Alright, here's the code. I've cut out some of the methods and a couple fields that I'd like to keep private. However, I've tried compiling files that contain just this code and got the same error. .../com/haliglond/demo/Orc.java: Java Code: package demo; import java.awt.Rectangle; public class Orc extends NonPlayerCharacter { public Orc(String selectedName) { name = selectedName; id = ++numberofCharacters; target = ...
I'm not convinced that that code produced that error message. Maybe you quoted the wrong part. Anyway... the error message should tell you what's wrong. You're subclassing an abstract class or implementing an interface, but you didn't give an implementation for a method required by the interface or abstract class. If you don't specify the implementation, the subclass isn't done, and ...