File tree Expand file tree Collapse file tree 2 files changed +17
-23
lines changed
Expand file tree Collapse file tree 2 files changed +17
-23
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -3,29 +3,34 @@ Simple but effective tool to translate Java source code into Python.
33Here's a quick example. First, the Java source:
44
55
6- $ cat HelloWorldApp.java
7- class HelloWorldApp {
6+ $ cat HelloWorld.java
7+ // This is the HelloWorld class with it's single method.
8+ class HelloWorld {
89 public static void main(String[] args) {
9- System.out.println('Hello, world.');
10- System.out.println(args);
10+ System.out.println("Hello, world.");
1111 }
1212 }
1313
1414Next, we translate:
1515
16- $ j2py -i HelloWorldApp .java
16+ $ j2py HelloWorld .java
1717 #!/usr/bin/env python
18- # -*- coding: utf-8 -*-
18+ """ generated source for module HelloWorld
1919
20- class HelloWorldApp(object):
21- ''' generated source for HelloWorldApp
20+ """
21+ # This is the HelloWorld class with it's single method.
22+ class HelloWorld(object):
23+ """ generated source for class HelloWorld
2224
23- '''
25+ """
2426 @classmethod
2527 def main(cls, args):
26- print 'Hello, world.'
27- print args
28+ """ generated source for method main
29+
30+ """
31+ print "Hello, world."
32+
2833
2934 if __name__ == '__main__':
3035 import sys
31- HelloWorldApp .main(sys.argv)
36+ HelloWorld .main(sys.argv)
You can’t perform that action at this time.
0 commit comments