The difference between the syntax of java and python

In java

1 , A semicolon must be added after the end of a line; this is an English semicolon. ,

2 , When importing the package, use import java.util.math directly, that is, import the package directly

importstatic java.lang.Math.*;//Static import

This is a static import. When using it, you can directly use the method name in this class. System.out.println("random number:"+random());
It cannot be used directly without writing.
3 import java.util.Scanner;
Scanner sc = new Scanner(System.in);
System.out.print("Principal:");

    int money=sc.nextInt();

Use the above method to enter what you want to enter in cmd

In python:

1 , No need to add a semicolon at the end of a line

2 , When importing the package, you can directly use the import to import the package. class, or you can use the from package import class

3 , Content = input("The content that needs to be translated:") So you can enter things yourself in the console, and the entered things can be saved in content, so that you can use your own input later

4 , To judge whether the values are equal, use == to judge whether the values are equal, the returned result is a bool type result, True means the values are equal, False means the values are not equal. Then use is to verify whether the memory address, type, and value are consistent

Recommended Posts

The difference between the syntax of java and python
A brief summary of the difference between Python2 and Python3
What is the difference between python and pycharm
The difference between Python extensions
The difference between python2.x and python3.x
The difference between CentOS 7 and CentOS 6
What is the difference between synchronous and asynchronous Python?
The difference and connection between Centos and Redhat
First understanding of the difference between centos7 and centos6 (kernel, commands, etc.)
What is the difference between a python script and a web page
The meaning and usage of lists in python
Basics of Python syntax
Basic syntax of Python
[898] python get the intersection of two lists | union | difference
Solve the problem of python compiling and installing ssl
The difference between CentOS and Ubuntu in Linux system
Consolidate the foundation of Python (4)
Consolidate the foundation of Python(7)
Consolidate the foundation of Python(5)
Consolidate the foundation of Python (3)
The usage of wheel in python
Magic methods and uses of Python
Python handles the 4 wheels of Chinese
Python simulation of the landlord deal
What is the use of Python
Mongodb and python interaction of python crawler
The premise of Python string pooling
Secrets of the new features of Python 3.8
The father of Python joins Microsoft
The operation of python access hdfs
The usage of tuples in python
End the method of running python
Python basic syntax and number types
Understanding the meaning of rb in python
Can Python implement the structure of the stack?
Learn the basics of python interactive mode
What are the required parameters of python
Logistic regression at the bottom of python
The usage of Ajax in Python3 crawler
Python solves the Tower of Hanoi game
Python implementation of intersection and IOU tutorial
Solve the conflict of multiple versions of python
What is the scope of python variables
Python implements the sum of fractional sequences
Two days of learning the basics of Python
What is the id function of python
Where is the pip path of python3
The essence of Python language: Itertools library
Example of python calculating derivative and plotting
What are the advantages of python language
The specific method of python instantiation object
python3 realizes the function of mask drawing
The relationship between Open3D version and Ubuntu
What is the prospect of python development
What is the function body of python
The specific method of python import library
Solve the conflict of multiple versions of python
Python realizes horizontal and vertical splicing of pictures
Python realizes the development of student management system
The basic configuration and interface beautification of Ubuntu
Python implements the shuffling of the cards in Doudizhu