I'm just starting to learn Java but I've hit a snag. I have this simple piece of code:
public class Main {
public static void main(String[] args){
}
}
But I keep getting errors like:
- Cannot resolve symbol 'String'
- Method 'main()' does not have signature 'public static void main(String[])'
I copied it exactly from a video I watched. Is it possible that JDK 24 has different syntax compared to JDK 23? Any advice would be greatly appreciated!
4 Answers
¿Qué IDE estás usando? Si es IntelliJ, a veces da problemas, yo te recomendaría empezar con Eclipse IDE. It's more beginner-friendly!
Make sure there are no typos in your code. What you pasted should work just fine. Also, how are you compiling it? Are you using a command line or an IDE?
If you're using IntelliJ, it can sometimes forget which JDK to use. Try restarting IntelliJ or purging the cache—it might just need to re-recognize your JDK settings!
It sounds like maybe you made a small typo. Check for any misspellings in your code. The error mentions 'Sting' instead of 'String' — make sure 'String' is spelled correctly. Just double-check what you've pasted there!
Yeah, I did miss that 'r'. Thanks for pointing it out!

I'll give that a try, thanks for the tip!