I want to use a method of a class onto another class.
eg: public class controller 1{
public void method 1(){}
}
public class controller 2{
public void method 2() { }
}
I want to use method1 in class controller2.
Please help me to find the solution on it
Best Answer
You can use two approaches:
1.Use Static methods
You cannot use controller2 instance methods here
In a separate class file call method2()
2.Create an instance of the other class
If your methods are in a package with a namespace