Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to learn Jython in Code Application

2025-04-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article is about how to learn Jython in code applications. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

By now, you should know more about the structure and syntax of Jython. The rest of the content * * is to learn Jython by analyzing several simple but complete working procedures. The first is the classic example program-- Hello WorldBright-- which is shown in Jython as follows:

Listing 1. Jython's Hello World!

Print "Hello World!"

In Jython (as in Python), the source file uses the extension "py". When the "Hello World" statement is placed in a source file such as hello.py, it is a complete program.

For comparison, take a look at the equivalent Java program and look at the following hello.java file:

Listing the Hello World of 2.Java!

Public class hello {public static void main (String [] args) {System.out.println ("Hello World!");}}

The format of Jython is obviously simpler, as it usually is. The good thing about Jython is that the code can be interpreted directly, or it can be translated into Java source code and automatically compiled into class files. You can run the Hello World program with the following Java command:

C:\ > java-Dpython.home=C:\ jython-2.1-cp C:\ jython-2.1\ jython.jar org.python.util.jython hello.py

You can also run the program with the following more convenient Jython script:

C:\ > jython hello.py

Thank you for reading! On "how to learn Jython in the code application" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 233

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report