I just started to learn Java a few weeks ago but gave up on it after hours of attempts and my code didn't work. Here is my input:

class JAVA
{
public static void main(String Args[])
{
System.out.println("Hello World");
}
}

I saved it as JAVA.java and tried to run it on Eclipse but it says there's an error. The error I forget what it was because it was like 3 weeks or so ago, but it wouldn't bypass the error for nothing.

I eventually grew tired of it and deleted it, but can any one explain why it didn't work?

Recommended Answers

All 5 Replies

because you need to write

public class java

instead of just class java

I'm not sure if this would effect it but you probably shouldn't name it JAVA because the extension is already java...not sure though

Member Avatar for ztini

Wrong sariberri.

class JAVA
{
public static void main(String Args[])
{
System.out.println("Hello World");
}
}

That is all legal java code (albeit poorly formatted and outside the bounds of naming conventions).

Did you download the the Java JDE? That is probably your issue. Perhaps if you could share the specific error you are experiencing, we could assist you. Stating "[your] didn't work" is too abstract to discern.

Best of luck.

Wrong sariberri.

class JAVA
{
public static void main(String Args[])
{
System.out.println("Hello World");
}
}

That is all legal java code (albeit poorly formatted and outside the bounds of naming conventions).

Did you download the the Java JDE? That is probably your issue. Perhaps if you could share the specific error you are experiencing, we could assist you. Stating "[your] didn't work" is too abstract to discern.

Best of luck.

I think it said it couldn't understand or break down some part of the code. And I don't know what a JDE is but I did get Eclipse which is a Java Development Environment(if that's what you're referring to).

I try to execute the code but an error comes up, but as I said before I don't have that IDE any more I just want some suggestions as to why it didn't work.

Member Avatar for ztini

I just want some suggestions as to why it didn't work.

1. The moon was in the wrong location.
2. A butterfly flapped its wings in a remote corner of the Amazon.
3. Your computer hates you.
4. Natural selection.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.