Okay, let's see how one would write such a comment. The method is called
addGas. And we need to describe it's purpose in plain English. So, just say
Adds gas to the tank of this car. The method has a parameter, and for every
parameter, we'll need an @param clause. Put in the name of the parameter, and
then a description. The amount of gas to add. Do we need a @return clause? No,
because this method, returns void. That's the Java.comment. When you generate
the documentation again, now the comment is included in the webpage.
Bien, veamos como uno escribiría dicho comentario. El método se llama
«addGas». Y necesitamos describir su propósito en inglés simple. Bien, solo digan:
Añade gas al tanque de este coche. El método tiene un parámetro y para cada
parámetro, necesitaremos una cláusula «@param» Pongan el nombre del parámetro y
luego una descripción. La cantidad de gas a añadir. ¿Necesitamos una cláusula @return? No,
porque este método presenta un retorno vacío. Ese es el comentario «javadoc». Cuando generan
la documentación otra vez, ahora el comentario se incluye en la página web.
Bon, voyons comment on
écrirait un tel commentaire.
La méthode s'appelle addGas
et nous devons décrire son but
en termes simples.
Dites simplement: Ajouter de l'essence
dans le réservoir de cette voiture.
La méthode a un paramètre et
pour chaque paramètre,
nous aurons besoin
d'une clause @param.
Mettez dans le nom du paramètre,
puis une description,
la quantité d'essence à ajouter.
Avons-nous besoin
d'une clause @return?
Non, parce que cette méthode
renvoie un vide.
C'est le Java.comment.
Lorsque vous générez à
nouveau la documentation,
le commentaire est maintenant
inclus dans la page Web.
ではどんなコメントになったでしょうか
メソッドはaddGasです
この役割を簡単な英語で説明します
この車にガソリンを補充するとします
このメソッドにはパラメータがあります
すべてのパラメータには@paramが必要です
パラメータに名前とthe amount of
gas to addという説明をつけます
@returnは戻り値がvoidなので不要です
これでJavadockコメントができました
再度コードの書き出しを実行すると
Webページにはコメントが含まれています
주석을 어떻게 작성하는지 봅시다. 메소드의 이름은
addGas입니다. 그리고 이 메소드의 쓰임새와 목적을 작성해야 합니다. 그래서
'자동차의 기름을 넣는다.'라고만 해도 괜찮습니다. 이 메소드는 매개변수가 있습니다.
매개변수를 설명할 때 @param을 앞에 꼭 써야 합니다. 그리고 그 옆에 매개변수 이름을
쓰고 그에 대한 설명을 작성합니다. @return 을 작성할 필요가 있을까요? 아닙니다,
왜냐하면 이 메소드의 리턴 형은 void이기 때문 입니다. 이렇게 하면 javadoc 주석이
완료됩니다. 이제 문서를 열면 웹페이지에 주석이 생깁니다.
Eens kijken hoe je
zo'n opmerking zou schrijven.
De methode heet addGas
en we moeten het doel ervan
beschrijven in duidelijke taal.
Zeg maar gewoon: Voegt benzine toe
aan de tank van deze auto.
De methode heeft een parameter,
en voor elke parameter hebben
we een @param clausule nodig.
Zet de naam van de parameter in
en een beschrijving.
De hoeveelheid toe te voegen benzine.
Hebben we een @return clausule nodig?
Nee, want deze methode
retourneert ongeldig.
Dat is de Java.comment.
Als je de documentatie weer genereert,
wordt nu het commentaar
opgenomen in de webpagina.
Okay, hãy xem xem người ta sẽ viết comment như nào. Method được gọi là addGas.
Và ta cần phải mô tả mục đích của nó bằng Tiếng Anh đơn giản, Nên, chỉ đơn giản ghi là
Add gas to the tank of this car. (Thêm xăng vào bình của cái xe này). Method có một parameter, và cho mỗi parameter,
ta cần một lệnh @param. Cho tên của parameter vào,
và sau đó là chú thích. The amout of gas to add. (Lượng gas cần thêm). Ta có cần một dòng @return không?
Không, vì method này, không trả về gì cả. Đó là javadoc comment. Khi bạn tạo
tài liệu một lần nữa, bây giờ comment đã được thêm vào trang web.