Does CodeGym explain debugging in later lessons? If so, do you know which level? thank you. Any input is greatly appreciated.
I am completely helpless with these new debugging tasks.
Resolved
Comments (28)
- Popular
- New
- Old
You must be signed in to leave a comment
MaGaby2280
16 January 2020, 16:11
I am lost as well, I have tried changing the acess modifier, but still won´t pass ;o(
0
Picvajzmen
29 July 2019, 07:50
can someone tell me why this access modifier changed the result like this???
0
Darko Jakimovski
16 May 2019, 11:20
It was the freaking accsses modifier
+4
Bazsó Benjámin
6 June 2019, 13:49
somehow i also found this after some blood and tears but i still have no idea why this is the solution xd
+1
Darko Jakimovski
6 June 2019, 14:00
I can't remember the code, but I remember like maybe I understood why :D
0
Robert
26 June 2019, 00:13
Thank you Darko! I could not for the life of me figure out why I was bouncing up and down even using the debugger until I read your note!
0
Darko Jakimovski
16 May 2019, 11:15
Ok so I figured out that the parent class is actually calling the child class method instead of it's own, but why? I'll keep you guys up to date it seems :D There seems to be a lot of viewers
+2
MaGaby2280
16 January 2020, 16:02
If you could help me out on this, I am stuck and its driving me crazy... I changed the access modifer but still wont verify, could you help me?
0
Darko Jakimovski
16 May 2019, 11:02solution
Did you find the bug yourself? I'm almost ready to hulk smash the shit out of everything around me
+7
// Java Poser
16 May 2019, 16:28
Lmao I labeled this comment as the solution haha
+2
Henk
22 May 2019, 10:31solution
ROFL!
+2
Darko Jakimovski
16 May 2019, 10:25
Are there any lessons on debuging further down the road? If yes say yes
+1
// Java Poser
16 May 2019, 16:29
I'm on 18 and still nothing on debugging, which is a must have skill according to every developer on the planet
0
Darko Jakimovski
17 May 2019, 09:21
Yeah I know, but I've been skipping it for far too long and hoped that code gym will cover me on debugging as well on Enums :/
+1
// Java Poser
17 May 2019, 10:28
Good point, I've also skipped it. I plan to go back at the end of level 20 and complete incomplete tasks. I have about 10 as of now
0
Darko Jakimovski
17 May 2019, 10:56
Same here :)
0
Oleh
15 April 2019, 13:30
Not sure, maybe professor knows.
I can try to explain.
1. Put breakpoint on the line, where you want to stop. Program will running until this point, and then stop. To put breakpoint just click near number.
2. Now you can start debugigng: right mouse button on the class with main method -> "Debug Solution.main"
3. You are debugging now. There are some command buttons here. The basic operation is "step into". That means execute current line and go to the next.
4. The coolest thing is that you can see values of variables of the current program's state.
Enjoy!
+9
// Java Poser
15 April 2019, 13:45
woah nice explanation man! thank you so much!
+1
Oleh
15 April 2019, 13:48
np
+1
Guadalupe Gagnon
15 April 2019, 14:34
One thing that I like to use is to set up a 'test/debug' mode for my code using a boolean switch. Basically declared a globally available boolean, I like to stick it in a static class, then just make a bunch of 'if' statements throughout your code to output information as needed. Example:
+2
Guadalupe Gagnon
15 April 2019, 14:42useful
This is a task (0717) that just takes 10 strings from the user, stores in a list, and then uses the doubleValues method to duplicate each one in the list. At the top is where i declared the global boolean to use. The first place I used my bool value is at line 11. If the flag is set to true it over rides the get user values and uses 10 hard coded values. This is so everytime I wanted to test the code I didn't have to enter 10 values. Then at lines 25, 29, and 31 you will see 'if' statements that use the flag. When it is set to true these lines activate and I can step through the output to see what is happening in the code. When you have identified all the problems and the code is working according to task conditions, just set the value to false and all that extra information will be shut off. Your task can then successfully be verified. Try to use this along with what Olef explained and these should cut down on the time you spend trying to find the few errors that will occur.
+5
// Java Poser
15 April 2019, 16:20
Damn Guadalupe, where are you learning all this stuff? I'm very open to resource recommendations and I think CodeGym should let you write a debugging article. Thank you as always friend!
+1
Guadalupe Gagnon
15 April 2019, 16:37
This one I came up with on my own, sort of. I used to write sys.out statements all through my code back when I first started learning. It was the best way for me to figure out what was going on, because stepping through the code in my head or writing it on a piece of paper was time consuming. Those extra lines are auto-fails on most tasks, so I had to remove them all when I was complete. So when I would do this, every now and then I would fail a part of verification and not know why. Because i got rid of all the 'debug' output, I then had to add it all back(i did start commenting in/out these instead of deleting after a few times doing this). This started to become time consuming too, so I came up with the idea of doing it this way.
I have used Visual Studio with C# and VS's debug mechanism has a native way to output data to console that gets ignored when compiled. Instead of using 'sys.out.println' for debug output, in VS you would use debug.println. IntelliJ doesn't do this but I came up with my way because I wanted to have this happen. It is close enough and helped me alot.
+2
Fadi Alsaidi
2 February 2020, 22:39
So what would you do if you want to step into the entire code from the example above? is there away to do that? if i tried to do a break pint in the main method, and it didn't work. Intelij used to have an easy step into code than now.
0
John
19 June 2021, 10:29
hey Guadalupe, off topic. i just want to know if i should avail a premium subscription if i add codegym plug in in dwsktop intellij. coz it seems like it. i tried and only few task are available others ask for subscription unlike here on android which is the only thing unavailable is the video part
0
Guadalupe Gagnon
20 June 2021, 18:10
A subscription allows you to download all the tasks directly to intellij and pass them in from there, but that doesn't mean you can't just copy + paste the task code in and use intelliJ to solve the task and then copy the solution.
+2
John
21 June 2021, 11:55
i cant copy paste since the web version also ask for subs, so maybe ill just continue using phone. thanks
0
Guadalupe Gagnon
21 June 2021, 13:28
You don't have to specifically "copy and paste" to copy the code into intelliJ and back into codegym. I still think your coding will speed up, as well as your ability to locate and squash bugs, with IntelliJ enough that it will still be faster to do it that way.
+1