java相当于#by python

时间:2015-07-31 12:05:15

标签: java python

我想转换这行python:

z = 1.0 #1.0 = 85%, 1.6 = 95%

到java,比如:

 double z = 1.0 ;

我不知道python,我只想尝试将the reddit ranking algorithm for comments转换为java。

2 个答案:

答案 0 :(得分:3)

在Python中#是评论。 在java中,您使用//进行单行评论和

进行评论
/*
**
/* 

用于多行评论。

在java中你可以这样做:

double z = 1.0; //1.0 = 85%, 1.6 = 95%

答案 1 :(得分:0)

Python中的注释以井号字符#开头,并扩展到物理行的末尾。这是一条单行注释。

# this is the first comment spam = 1 # and this is the second comment # ... and now a third! text = "# This is not a comment because it's inside quotes."

在Java中,等效项是//。

//this is the first comment int spam =1 // and this is the second comment //... and now a third!

还使用python """..."""中的多行注释。其Java等效项为:/*...*/.