开发者

Will it return my method name if called

private IPerson savePerson;

    public IContact getsaveContact() {
        System.out.println("Hello");
        //info("Coming Here");
        return savePerson;
    }

    public void setsaveContact(IPerson contact) {
        this.savePerson= savePerson;
    }

package 

import Contact;

public interface IPerson {

    public void savePerson(Contact contact);

}

I have an interface IPerson with methodname savePerson. I need to access that method name. What i do is above, when i call my getsaveContact meth开发者_JAVA百科od will it return savePerson method name of my Interface

I dont want to implement the interface at all, but i need to call the method name inside through some way... i heard we can do it via getter and setter methods.


If you are asking if

public IContact getsaveContact() {
    System.out.println("Hello");
    //info("Coming Here");
    return savePerson;
}

Will return the name of the savePerson method. Then no. This code returns the IPerson object defined in

private IPerson savePerson;


this looks like an error to me:

public void setsaveContact(IPerson contact) {
     this.savePerson= savePerson;
 }

im guessing this should be:

public void setsaveContact(IPerson contact) {
     this.savePerson= contact;
 }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜