+ 1

Codes that runs fine in Playground won't work in Eclipse

In Eclipse, this code throws the error "Type mismatch: cannot convert from java.lang.String to test5.String", while here runs perfectly fine. Here are the codes: https://code.sololearn.com/cwVdGhCSgDnb https://code.sololearn.com/cqMvwu11l0lh Thanks in advance for any help!

18th Jun 2018, 3:19 AM
DIY Mods
DIY Mods - avatar
5 Answers
+ 2
Sololearn ide for non web codes is very limited. E.g. You can't input data sequentially but you have to input it all at once. I recommend you make the codes first in eclipse and then trying them here.
18th Jun 2018, 7:39 AM
Haris
Haris - avatar
+ 1
Double check your imports as Eclipse does some automatically, or you may have some files from another part of a project that is being used as an import. It thinks the 'String' declaration in your code is some other class
18th Jun 2018, 6:19 AM
Dan Walker
Dan Walker - avatar
+ 1
Based on your error message it sounds like an import thing, maybe copy paste your code exactly as it appears in eclipse. default package is basically no package. Maybe there is a package private class you've made that is causing the conflict. The imports are usually folded away on eclipse so you won't be able to see what's changing as you move and save the files
18th Jun 2018, 3:48 PM
Dan Walker
Dan Walker - avatar
0
The thing is, that when I moving the class to "default" package it works perfectly fine. What is that?
18th Jun 2018, 3:01 PM
DIY Mods
DIY Mods - avatar
0
The problem was in the class's name. Thank everyone for the help! If you don't mind, can you, please, take a look at this question? https://www.sololearn.com/Discuss/1355241/java-how-to-remove-the-word-variable-from-the-output Thanks!
19th Jun 2018, 12:54 AM
DIY Mods
DIY Mods - avatar