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
- 5
Locked
Comments (21)
- Popular
- New
- Old
You must be signed in to leave a comment
miguel
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
coffeemess
1 November 2021, 18:26
you can
0
Sinisa
4 March 2021, 20:14
Using Scanner is more effective. It can read int directly without converting them from string to int.
0
Edddieg
25 June 2020, 03:31
make this change to line 15
and it should work
if (name.isEmpty()|| name.equals(" ")) break;
+1
Karas Java Developer
7 September 2020, 23:51
It worked, also make sure you add a space.
0
Roman Grygorczuk
21 November 2020, 16:28
the position of if statement is very important
+1
ImDevin
25 April 2021, 23:23
space is not necessary.
0
ImDevin
25 April 2021, 23:25
it passes without || name.equals("")
0
Peter Karanyi
12 June 2020, 17:16
My code compiles in IntelliJ, then I copy paste it here, and won't compile...
How is that possible???
0
Alex Vypirailenko Java Developer at Toshiba Global Comme
13 June 2020, 07:07
Please submit a question with your code in the Help section.
0
Nickolas Johnson
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.
0
Log
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
+2
hidden #10568956
25 February 2020, 08:26
They need to fix this one... i was able to pass with a nullpointerexception.
+1
Roman
26 February 2020, 07:57
Please give me your code in direct message.
0
Bert Doe
9 April 2020, 08:39
I also passed this one with a null pointer exception
0
IsoVent
15 November 2020, 20:24
...pass with a null pointer exception.....
0
Elżbieta
18 November 2020, 10:33
I also passed with the NullPointer
0
Daniel
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).
+1
KIN SOCHEAT
3 June 2019, 06:39
Thanks...all ok
0
KIN SOCHEAT
3 June 2019, 01:49
who know why isEmpty not work? Thanks
0
Roman
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.
0