簡體   English   中英

與python中的#等價的Java

[英]java equivalent of # in python

我想轉換這行python:

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

到Java,例如:

 double z = 1.0 ;

我不了解python,我只是想將reddit排名算法轉換為Java 注釋

在Python中, #是注釋。 在Java中,您對單行注釋使用//注釋

/*
**
/* 

多行注釋。

在Java中,您可以這樣做:

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

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等效項是: /*...*/.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM