Arcane_Disciple
03-02-2003, 01:49 AM
public class Welcome
{
public static void main(String[] args)
{
String[] greeting = new String[2];
greeting[0] = "Hello";
greeting[1] = "This is my first Java program";
for (int i = 0; i < greeting.length; i++)
System.out.println(greeting[i]);
}
}
Here is my error
testing/testing.java [1:1] class Welcome is public, should be declared in a file named Welcome.java
public class Welcome
^
1 error
I got this example from a website and copied word to word. What is wrong with it?
{
public static void main(String[] args)
{
String[] greeting = new String[2];
greeting[0] = "Hello";
greeting[1] = "This is my first Java program";
for (int i = 0; i < greeting.length; i++)
System.out.println(greeting[i]);
}
}
Here is my error
testing/testing.java [1:1] class Welcome is public, should be declared in a file named Welcome.java
public class Welcome
^
1 error
I got this example from a website and copied word to word. What is wrong with it?