Passing a method from another class

后端 未结 4 506
渐次进展
渐次进展 2020-12-22 03:09

I want to call a method from one class to another, don\'t know if that\'s possible without extends the class that contains the method. I\'ve tried to import the package, tha

4条回答
  •  遥遥无期
    2020-12-22 04:02

    You need an instance of object from class 1 to invoke that method, or if it doesn't need an instance - you can declare it as static and then you can write 1.method().

提交回复
热议问题