Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I obtain the type of a Java instance in Jython?

from java.util import LinkedList
type(LinkedList())

The code above only gives "type 'javainstance" as output, however I wish to know the real Java instance type, which should be "LinkedList" in that case. Is this possible?

Thank you!

by the way, my version is jython 2.2.1


1 Answers

Howard, if you are on older Jython then try to call

LinkedList.getClass()

and

object.getClass().getName()

like image 168
Edmon Avatar answered Mar 26 '26 01:03

Edmon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!