How to call a method in another class of the same package?

Create an instance of Class B:

B b=new B();
b.method();

or define an static method in Class B:

class B
{
 static void staticMethod();
}

and call it like this:

B.staticMethod();

Leave a Comment