"Yine mi boş boş oturuyorsun? Sen bir robotsun! Robotlar her zaman bir şeyler yapar. İşte paslanmanı önleyecek birkaç egzersiz. Ama önce birkaç ipucu:"
"İpucu 1:
'Liste' derken, genellikle bir ArrayList'i kastediyoruz ."
"İpucu 2:
Bir 'dize', bir String nesnesi anlamına gelir."
"İpucu 3:
'Dize listesi oluştur' çoğunlukla şu anlama gelir: ArrayList<String> list = new ArrayList<String>(); "
2
Görev
Java Syntax, seviye, ders
What sort of list is that?
Java programmers love their lists just as much as conscientious homemakers love their shopping lists and to-do lists. If you haven't fallen in love with them yet, it's time to start. And a programmer's love begins with code. So, in this task, we'll create a list of strings, add 5 different strings, and then display the size of the list on the screen. Then we'll display the contents of the list. Easy peasy!
10
Görev
Java Syntax, seviye, ders
Longest string
Let's measure strings! And we'll complete a programming task at the same time: create a string list, read 5 strings from the keyboard, and add them to the list. Then use a loop to find the longest string (or longest strings, if there is more than one). A country should know its heroes: the longest strings will be displayed.
5
Görev
Java Syntax, seviye, ders
Expressing ourselves more concisely
Brevity is the soul of wit. In the this task, let's celebrate brevity by doing the following: create a list, read 5 strings from the keyboard, add them to the list, find the shortest string, and then display it. If several strings are shortest, we'll display them all, each on a new line. Any questions, private?!
2
Görev
Java Syntax, seviye, ders
To the top of the list
Imagine people making appointments at a dental office where the waiting list acts like a stack rather than a queue: the last person to schedule is the first to have a drill taken to his or her tooth. We'll write a program that reflects this unusual situation: create a list and add 10 strings, but we'll add them to the beginning of the list rather than the end.
5
Görev
Java Syntax, seviye, ders
Remove and insert
Manipulating lists in Java is almost as easy and enjoyable as manipulating people! Anyway, about those lists. Here's what you need to do: create a list and add 5 strings. Then remove the last string and insert it at the beginning. Repeat this manipulation 13 times and then display the contents of the list. Why? Don't ask, just believe: it's necessary.
10
Görev
Java Syntax, seviye, ders
Shortest or longest
Java games with lists are very popular. This makes sense, since they are all so simple and interesting. Join in the fun! In this task, we create a list of strings. Then we add 10 strings from the keyboard. The most interesting part is that we'll determine whether the shortest string or the longest string is encountered first in the list. If more than one string is shortest or longest, we'll consider the very first one we encounter.