Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
Documents can be used to describe what a function does in the past three workbooks, LFG documents to
guide your code, and this one is from Workbook four point three.
Notice how easy it is to read, because very succinctly, it tells you exactly what the function does,
what the parameters are and what the function returns.
If you're working in a team of developers, you should have a document for every function, it helps
collaborators understand what your function does without having to read your code.
So in this lesson, you're going to learn how to write documents.
First thing I need you to do is create a new class by yourself inside the section for project, create
a new file named Comments Java and make sure the class has a main method.
So we're going to start off by writing a function.
Inside documents generate a random function that void.
I'm going to call that Grete.
And it's just going to print high.
And just before the function, I'm going to write slash star star.
And press enter a few times, and Java creates a skeleton first threat, a dark comment next to the
first hour, I'm going to write function name.
Which is Grete.
And beside the last hour, I'm going to write inside the function.
Followed by a bullet point that describes what it does and it prints hi.
There you go.
This document effectively describes whatever function does.
Now we're going to write a function with parameters.
Public static.
It's going to be void and I'm going to call it print text.
And it's going to receive, too, string parameters, name and age.
And inside the function, I'm going to print high.
I'm.
Whatever name value was Pastan.
And whatever age value is Pastan.
Years old.
And now, once again, before the function, I'm going to write Star Star.
Press enter a few times and check it out, it recognizes the two parameters in my function.
And now this is just the preference, but in brackets, I'm going to add the data type of each parameter,
so the name parameters of type string.
And the parameter is of type string as well.
Now, like before, right, the function name beside the first star.
And describe the function beside the last hour, so we'll say inside the function.
Colin.
I'm going to add a bullet point that says this function prince, the name and age is part of a text.
Now we're going to read a function where they return value and documenter.
I'm going to make a function that returns a double.
I'm going to call it calculate area.
And it's going to receive two parameters, length and what?
And inside the function, I'm going to calculate the area of a rectangle by multiplying the length and
width values that are passed in.
And then I'm going to return the area value.
And once again, right before the function, I'm going to write Star Star.
Press enter a few times and check it out this time it recognizes the parameters and that you have a
return value.
And you know me, I like the data type of each thing in brackets.
The parameters are all of type double.
And the return value as a double as well.
As always, I would add the function name.
And next to the last hour, I'm going to describe the function by saying inside the function.
And then I'll add a bullet point that says this function calculates the area and returns.
That's all pretty easy, isn't it?
All you have to do is press star, star a few times and Java creates a skeleton that we can use to fill
out and document our function.
In this lesson, you learn to describe functions using Javadoc when you write Star, a star followed
by Enter Jova generates the format and all you have to do is write the function name, give a small
description, and if you want to get super fancy, write the type of each thing in brackets.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.