Add Python demo for showing how to embed Python in Java
[jython-java-sample.git] / src / main / python / InterfaceTest.py
blob71025feb7124f5855833a6320d834619d7d62c98
1 import java, time
2 from com.smartitengineering.demo.jython.test import TestInterface, TestName
3 from java.lang import Runnable
5 class MyTestInterface (TestInterface):
6 def isDivisible (self, a, b):
7 c = a % b
8 if c == 0 :
9 return bool("true")
10 else :
11 return bool("false")
13 def printName(self, name):
14 print name.getName()
15 name.setRead(bool("true"))
16 def getName(self):
17 testName = TestName("Farhana Kabir")
18 return testName
20 class MyRunnable (Runnable):
21 def run(self):
22 print "This is a Runnable Thread without compilation"
23 print "Time: ", time.time()