» Home » superclass » Page 1
Overriding a method in the superclass' superclass in java?
by Johan_B in Java
class A
public void Foo() {}
class B extends A
class C extends B
public void Foo() {}

Does C's Foo() override A's even though B did not override it? Or do I have to add a stub in B that calls the super's method for each one I want to override in C?

Calling superclass method in superclass
by clamum in Programming Languages

I am not able to find a good summary to describe my problem (suggestions welcome)

I have following two classes:


import java.lang.reflect.Method;
abstract class Test1 {
boolean condition = true;
public void f() {
System.out.println("Test1 : f");
public void g() {

Passing subclass or superclass object to method (expecting a superclass object)
by sub-80 in Programming Languages

I'm working with some code that needs to send either a superclass or subclass object to a method.

The method public void repair(Vehicle vehicle) will ONLY access methods in the super class object.

public class Vehicle {
//class stuff
public class Car extends Vehicle {
//class stuff
public static void main(String

Override a method but leave superclass's calls to that method going to superclass's version of that method
by futurefields in Programming Languages

Is it possible to override a method in a subclass in such a way that when the superclass calls the method, those calls still go to the original method, but all other (external) calls to the method go to the overridden version?

Background: If I subclass a UITextField and override the getter for delegate, the built-in behavior of UITextField that

Java: Generics, superclass type reference pointing to <? extends superclass> type reference
by Bunny loves data in Programming Languages

In the following code that I tried to compile:

List<Animal> animals;
List<? extends Animal> some;
animals = some;

I got the following error:

Type mismatch: cannot convert from List<capture#2-of ? extends Animal> to List<Animal>

But a list containing <? extends Animal> is

Can someone explain the Class.superclass.class.superclass paradox?
by Matt Watson in Programming Languages

It's probably not a paradox at all, but from a newbies perspective, it sure seems that way.

> Class.superclass
=> Module
> Class.superclass.class
=> Class
> Class.superclass.class.superclass
=> Module

So a class's parent is module, but module is a class?

How can I make sense of this?

PHP superclass and subclass
by James Clarke in Development

A simple question, does the following make sense ?

Class B extends Class A

class A constructor:

function __construct(){
//do something

Class B constructor:

function __construct(){

Is there any significant advantage to implementing the child cons

How can I ignore a superclass?
by LinAdmin in Programming Languages

I'm trying to write a web service for the java.util.logging api. So I wrote a class MyLogRecord that inherits from LogRecord. I annotated this class with JAX-B annotations, including @XmlAccessorType(XmlAccessType.NONE) so it would ignore non-annotated fields and properties. When I start up tomcat, I get errors that java.util.logging.Level and other

I do not understand 'this' being used with a superclass
by Sivavt in Programming Languages

I have two classes and an interface shown below.
Quick summary: Interface Winterface, Class Big, Class Little that extends Big and implements Winterface.

public interface Winterface {}
public class Big {
public int hello = 88;
public Big() {}
public void theMethod() {
System.out.println ("Big was here: " + (this instanceof Winte

Construct a subclass from a superclass
by kiirpi in Programming Languages

This is all in the context of JBox2D (in Java). The World class creates Body instances with a function. I'm trying to add a bit more stuff to Body for my application. Body is represented by ComplexClassWithLotsOfAPI in this question.

Here is the generalized question. I am trying to add a bit more functionality to a premade class by extending the class. I hope to do something

Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .