Calling static methods in Jython

Steve Purcell stephen_purcell at yahoo.com
Tue Feb 13 03:54:12 EST 2001


Daniel Wickstrom wrote:
> 
> I've already posted this on the jython-users list, but I haven't
> received a response.
> 
> I want to use Jython with some existing java classes that contain
> static methods.  How does one call java static methods from Jython?

Just as you would do it in Java:

Jython 2.0 on java1.2.2 (JIT: javacomp)
Type "copyright", "credits" or "license" for more information.
>>> import java.text.DateFormat
>>> df = java.text.DateFormat.getDateInstance(java.text.DateFormat.MEDIUM)
>>> df
java.text.SimpleDateFormat at ce9bf0a5


-Steve

-- 
Steve Purcell, Pythangelist
http://pyunit.sourceforge.net/
http://pyserv.sourceforge.net/
Available for consulting and training.
"Even snakes are afraid of snakes." -- Steven Wright




More information about the Python-list mailing list