This has to do with abstract and how can i acesses it with a getmethod()

Ok lets say I have a class called class A and a abstract class called class B ok I want to beable to access the methods in class B how can I do this ??I know I could make the method static and get to the method like B.methodIWant() but I want to access it like something like I have down below.Thank you for anyhelp you can give on this thanks
This is what I was tring but its not working cause it returns a nullpointer and I dont know how to get this to work right can someone plz show me how to get this to work correctly or point me to some links that will explain or something.
publc class A
publc A()
  B bb = B.getB();
   bb.methodIWant();
public static void main(String[] arguments)
    A aa = new A();
abstract class B
  static b C = B.getB();
  public static B getB()
    return B.C;
  public void methodIWant()
   System.out.println("got it");
} Jimmy

I have another ?.This is about interfaces ok lets say I take the code I have here and add a interface D to this like so
public class A implements D{
public A()
   B bb = B.getB();
   bb.sayItWorks();
   saySomthingElse(bb);
public void saySomthingElse(B bbb)
  bbb.saySElse();
public static void main(String[] arguments)
   A aa = new A();
abstract class B
  private static C cc = new C();
  public static B getB() { return cc; }
public abstract void sayItWorks();
public void saySElse()
   System.out.println("See ya");
class C extends B
  public C() {}
  public void sayItWorks( )
   System.out.println("It works,HELL YEAH!!!!,Thank you KAYAMAN" );
interface D
  public void saySomthingElse(B bb);
}Ok My ? is y do we really need a interface I mean I could have done this just by adding a method in the A class.So what I am wanting to know is a interface just use for design issues?

Similar Messages

Maybe you are looking for