The first postulate of the intergalactic railway states: if cats have a problem, abandon everything to help them solve it. Because having problems is contrary to the nature of cats. So we have a program that displays cat data after reading it from the keyboard. But something isn't right, and it won't compile. Fix the bug!
Cat code won't compile
You must be signed in to leave a comment
17 August 2021, 17:23
hi everybody, why I can't assign conversion to integer before doing the the object? int age = Integer.parseInt(reader.readLine()); So I mean, for example new Cat(name, age....... ;)
1 November 2021, 18:26
4 March 2021, 20:14
Using Scanner is more effective. It can read int directly without converting them from string to int.
25 June 2020, 03:31
make this change to line 15 and it should work if (name.isEmpty()|| name.equals(" ")) break;
Karas Java Developer
7 September 2020, 23:51
It worked, also make sure you add a space.
21 November 2020, 16:28
the position of if statement is very important
25 April 2021, 23:23
space is not necessary.
25 April 2021, 23:25
it passes without || name.equals("")
12 June 2020, 17:16
My code compiles in IntelliJ, then I copy paste it here, and won't compile... How is that possible???
Alex Vypirailenko Java Developer at Toshiba Global Comme
13 June 2020, 07:07
Please submit a question with your code in the Help section.
30 March 2020, 19:51
Log was right, for some reason you have to put another line in the input box for it to work. Gotta say, I hated this one with a fiery passion. I need a fregin break after this one.
12 March 2020, 14:17
After digging around the help files I discovered that my code originally didn't work because I needed to add a blank line at the end of the pre-written input data. Wasn't expecting to have to mess around with the Input box
25 February 2020, 08:26
They need to fix this one... i was able to pass with a nullpointerexception.
26 February 2020, 07:57
Please give me your code in direct message.
9 April 2020, 08:39
I also passed this one with a null pointer exception
15 November 2020, 20:24
...pass with a null pointer exception.....
18 November 2020, 10:33
I also passed with the NullPointer
25 January 2020, 15:58
If you find the requirements a bit confusing, then all you have to do is FIX existing code and add what is needed so if you enter name(string), age(int), weight(int), tail (int) it creates an object with those characteristics (variables). If name is empty, program stops and prints existing data; if no data....then it prints nothing(in case first name is empty, program breaks and prints nothing).
3 June 2019, 06:39
3 June 2019, 01:49
who know why isEmpty not work? Thanks
3 June 2019, 06:24
If you need help, something isn't right in your code, the server won't accept your solution (even if you are 100% sure that it is correct). Describe your question/issue in the HELP section at codegym.cc/help.