Skip to content

Tag: if-statement

How can I check if the user input is a string

I’m trying to check if the user inputs a string. If the user inputs a string, my program should output an error message. If the user enters an integer my program should proceed with the program Here’s my code so far, I need to add another condition to check if the user inputs string, I tried some methods but they

Finding the longest word ArrayList /Java

I want to write a method which finds the longest String (word). The output should be the longest word in case of two words with the same lenght the output should be: “More than one longest word”. I used ArrayList and almost had a solution, but something goes wrong. The case is that I have a problem when two words