我想转换这行python:
z = 1.0 #1.0 = 85%, 1.6 = 95%
到java,比如:
double z = 1.0 ;
我不知道python,我只想尝试将the reddit ranking algorithm for comments转换为java。
答案 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等效项为:/*...*/.