Skip to content
Advertisement

Tag: for-loop

Find the first Recurring letter in Java

I wrote the code as follows but it doesn’t return the first recurring letter properly. Example: In the word “statistics” the recurring letters are s, t, and i. But the letter t recurs sooner than the letter s and i, but my program returns s instead of t. What do I need to do for it to return t, using

Do a task with interval in a loop

I already saw many question here but nothing worked for me. I wanted to set the text in a text view after every 1 second. This is what I tried: This does the task immediately and only the last number is seen. Then this: in this the screen shows blank white and after 90 seconds, I see the last number.

Implementing a printAnimals method

I am trying to implement a printAnimals() method that prints the ArrayList for dogs or prints the ArrayList for monkeys, or prints all animals whose training status is “in service” and whose is Not reserved, depending on the input you enter in the menu. I am trying to correctly write a for loop for both ArrayList that contains if statements,

Advertisement