Is Java fully object-oriented?

Is it possible to get javac, on OpenJDK7 or 8, to print out a list of what all the fully qualified referenced classes are used for a given class without having to write some parsing Java code?

  • Any solution must be 100% invisible to the source code

  • Answer:

    You're questions a bit wrong. You don't need javac. 1 2 3 4 5 6 7 8 9101112131415161718192021class QualifiedNameFinder { public String getQualifiedName(Object o) { return this.getQualifiedName(o.getClass()); } public String getQualifiedName(Class<?> c) { return c.getName(); } } Excuse the bad indentation. You can get the qualified name in three ways: 1) using an object- o.getClass().getName(); 2) using a class object-c.getName(); 3) if you only know the class name, you can get the name like this     YourClass.class.getName() Here I wrote a class with two overloaded methods that do the qualified name finding.

Rishav Kundu at Quora Visit the source

Was this solution helpful to you?

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.