Witam, skoro rozwiązanie to 4x
System.out.println(s)
To skąd wiadomo że "s" zawiera dany String skoro nie widzę zadeklarowanej zmiennej?
Proszę o wyjaśnienie rozwiązania.
Dyskutowane
Komentarze (2)
- Popularne
- Najnowsze
- Najstarsze
Musisz się zalogować, aby dodać komentarz
Guadalupe Gagnon
25 listopada 2022, 05:49
It's a variable. It is assigned a value when the method is actually called in other parts of code. That is what methods are, reusable pieces of code. If you hardcoded a value then it would reduce the methods usefulness. Consider having 10 methods to print the values 0-9, or one method that prints something and then call it 10 times to print the same:
So you could write code like this to print the numbers as described above:
+1
Guadalupe Gagnon
25 listopada 2022, 05:51
or you could use a general method (as it is supposed to be) to do the same with WAY less typing:
0