Beispiel #1
0
# https://www.tutorialspoint.com/jython/index.htm
# c:\Users\qcaij\OneDrive - University of Florida\Files\College\Coursework\Summer 2020\CIS 4930 - Special Topics - Performant Programming in Python\Python-Crash-Course\src\Third Party Modules\Jython\jython_tutorial.py
########################################################################################################################
# Importing Java Libraries

from java.util import Date

d = Date()
print(d)

import HelloWorld

h = HelloWorld()
h.hello()
h.hello("Isaac")

########################################################################################################################
# Variables and Data Types

x = 10
print(type(x))
x = "hello"
print(type(x))

# Jython Numbers
x = 42  # int
print(type(x))
x = 1234567890L  # long
print(type(x))
x = 42.42  # float
print(type(x))
import HelloWorld

# In zoo.cpp we expose hello() function, and it now exists in the zoo module.
assert 'hello' in dir(HelloWorld)
# zoo.hello is a callable.
assert callable(HelloWorld.hello)
# Call the C++ hello() function from Python.
print HelloWorld.hello()