अधिकतम
आपको उस लेबल सूची में सबसे लंबा शब्द ढूँढना है, ताकि आप जो विज़ुअल प्रिंट करने जा रहे हैं, उसकी बबल्स का आकार तय कर सकें.
यह अभ्यास पाठ्यक्रम का हिस्सा है
इंटरमीडिएट Java
अभ्यास निर्देश
wordsListको उपयुक्त टाइप दें.- लंबे शब्द का चयन करने के लिए सही comparison दर्ज करें.
- सबसे लंबा शब्द ढूँढने के लिए सही method दर्ज करें.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
class LongestFinder {
// Give the appropriate type to wordsList
static String findLongestIn(____ wordsList) {
String longest = "";
for (String word : wordsList) {
// Enter the fitting comparison to select the longer word
if (____)
longest = word;
}
return longest;
}
public static void main(String[] args) {
String[] words = {"possible", "first", "null", "avoidance", "mineral", "pretty", "tree", "rather", "innocuous"};
// Call the correct method to find the longest word
System.out.println(____(words));
}
}