Does java offer a simple way to do this?
I know how to get this using Foo.class.getName())
But how would I be able to do this for any object I may be passing in through some method? Say
public String getClass(File file){
// Get file class
}
Where file is some java file with a .java extension. I know it works if I directly hard code the name of the java class into Foo.class.getName()
, but my approach at this includes java files not found in the current directory or package. Anyone guide me in the right direction? Thanks in advance.