Getting Stuck on Java Basics: Help Needed!

0
21
Asked By CuriousCoder98 On

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

Answered By CodeNinja23 On

¿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!

Answered By DebugMaster07 On

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?

Answered By JavaWhiz89 On

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!

CuriousCoder98 -

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

Answered By CodeSleuth33 On

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!

CuriousCoder98 -

Yeah, I did miss that 'r'. Thanks for pointing it out!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.