1 year ago

#308590

test-img

to ma tpo pa

I need to differentiate methods that have the same signature in java

i have many similar methods like this

delete(String ProfilePrimaryKey)
delete(String PostPrimaryKey)
delete(String CommentPrimaryKey)

they all access the database in a different way and call for a different SQL function, I don't know how to differentiate them, to keep the same name for the method

can I do something like?

public void delete(Profile<String> ProfilePrimaryKey);
Public void delete(Post<String> PostPrimaryKey);
public void delete(Comment<String> CommentPrimaryKey);

that probably didn't make sense, at all. it was just to show how I need some way of having 3 methods that all have String as argument but some different types of string, thank you for you help

java

generics

polymorphism

overloading

signature

0 Answers

Your Answer

Accepted video resources