+ 2
Why do my java codes result in "compilation error" even if it is a short and simple code like this
16 Respuestas
+ 4
Hatsy Rei I removed some lines:
https://code.sololearn.com/cfj27oJABRuo/?ref=app
matt after removing all white spaces it works:
https://code.sololearn.com/cLhFc11nFqhY/?ref=app
+ 8
Personally, I can't stand using the web version either. It's much quicker for me to use a real IDE for writing, running, and debugging. Then, I can copy paste to share with the community.
The lag and timeout on SL can really slow down the code writing process for me.
But, that's simply my preference. 🙃
+ 7
BTW... I was slow to post my solution earlier and later noticed others posted working versions already. So, I removed my answers.
Denise Roßberg I haven't had any issues with copy and pasting from Sublime in either Windows or Mac.
I will need to test doing this with IntelliJ. However, I'm surprised such characters would appear in IntelliJ.
+ 6
Did you copy it from your pc? After removing all white spaces i got an error about illegal characters. So I think the code playground interpretes some characters wrong.
+ 6
Denise Roßberg I was about to mention the same thing. Invisible characters seem to be interfering with proper compilation.
+ 6
Denise Roßberg Unicode. Most likely custom IDE encoding, some which support UTF-8 would compile the code without errors (treating and possibly using the symbol as whitespace for indentation purposes).
http://www.fileformat.info/info/unicode/char/00a0/index.htm
Interesting though. Code Playground doesn't tell me anything about u00a0. I simply received a "Compilation Error" message without any hint as to what went wrong. Did you compile it using an offline compiler, or... ?
+ 6
Just FYI, I've been copypasting my work in and out of Jetbrains products, IntelliJ included. I've never met with such issues. I would advice looking into your IDE settings for encoding options.
+ 4
Hatsy Rei the illegal character is \u00a0 (mentioned in the error message) but I don't know which character it is and from where it comes. Has it to do with the used IDE?
+ 4
Hatsy Rei Now the question is: How to find such illegal characters? Removing all white spaces is very annoying.
+ 4
It's funny how this is a question that was bothering me, and I brought it up earlier in a different thread. This way of phrasing the question is indeed better and clearer than the way I phrased it there. See here:
https://www.sololearn.com/Discuss/1687269/?ref=app
It's really annoying, especially to me as a beginner. I can never know if my code didn't compile properly because of an error in the code, or because of Code Playground's limitations.
On a few occasions I've had code that wasn't compiling in Code Playground, yet a copy/paste into IntelliJ and it worked just fine!
+ 3
Denise Roßberg and Hatsy Rei thanks! I have a feeling you are right, and i did copy from my pc. I'll try manual entry into code playground and see if that works. Thanks again!
+ 3
David Carroll I mean in general. Because this problem is relatively common and especially beginners are very confused. I would like to have a tip on how to copy code from the PC to the Code Playground.
+ 3
matt Maybe an alternative to copy and paste: You can use the code playground on the website (using your PC).
+ 2
David Carroll The last time the problem arose, the coder had used Netbeans. I use Ecplipse, but have never tried to copy the code because I write for Sololearn directly in the Code Playground.
+ 1
Denise Roßberg great suggestion. I'll give it a try!
0
Denise Roßberg thanks for the link! I used IntelliJ to compile it on my pc and it ran without error there. Entry of code manually into code playground doesn't work very good using the keyboard of my mobile phone, so I copied/pasted a few codes I wrote and they all have the same compile error. I think your explanation makes total sense!