Every time I try to compile this code I get the same error but it doesnt seem to make any sense.

This is the code:

public class Software Development
{
   public static void main(String[]args)
   {
      System.out.println("Hello World");
      System.out.println("2name");
      System.out.println("name: \n"+name);
      System.out.println("\"name:\""+name);
   }
}

And this is the error:

Software Development.java:1: error: '{' expected
public class Software Development
                     ^
1 error

 ----jGRASP wedge2: exit code for process is 1.

Recommended Answers

All 3 Replies

it makes perfect sense. A classname has to be one single word.

public class SoftwareDevelopment
{
   public static void main(String[]args)
   {
      System.out.println("Hello World");
      System.out.println("2name");
      System.out.println("name: \n"+name);
      System.out.println("\"name:\""+name);
   }
}

and the filename should be SoftwareDevelopment.java

also, make it : String[] args instead of String[]args

Oh ok thanks for the quick reply. I was looking for an issue with the { and couldn't see any.

the issue was that the compiler expected the opening bracket right after the classname. There are cases where this is not so, for instance when you extend another class, or when you implement an/some interface(s), but then it is expected right after those names.
It's the name that was incorrect that sort of freaked the compiler out.

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.