Examining JPython
By Kirby W. Angell, April 01, 1999
JPython is a freely available version of Python implemented in 100 percent pure Java. Since JPython is written in Java, it is easy to include the JPython packages in a Java application and use JPython as your application's scripting engine. JPython also makes an excellent tool for prototyping Java applets that are embedded in web browsers.
Apr99: Programmer's Toolchest
<b>(a)</b>
>>> from java.util import Date
>>> d = Date()
>>> d.hours
19
>>> d.hours = 10
>>> d.hours
10
<b>(b)</b>
>>> from java.util import Date
>>> d = Date()
>>> d.getHours()
19
>>> d.setHours(10)
>>> d.getHours()
10
Example 2: (a) Writing code using java.util.Date's getHours and setHours methods; (b) a better example of using the Date class.
Copyright © 1999, Dr. Dobb's Journal