java equivalent of c# typeof()
问题 I'm very new to java. Say I've a xml parser and I'd create object from it. In c# i'd do like: parser p = new parser(typeof(myTargetObjectType)); In my parser class I need to know which object I'm making, so that i can throw exception if parsing is not possible. How to Do the same in jave? I mean how I can take arguments like typeof(myObject) I understand every language has it's own way of doing something. I'm asking what's way in java 回答1: Java has the Class class as the entry point for any