public class WelcomeName{
String myName="david";
public static void main(String[] args){
System.out.println("Welcome");
System.out.println(myName);
System.out.print("to the Java World");
}
}
As u can see from my code i am trying to print out;
Welcome
david
to the Java World
When I try to compile the program i get an error saying "non-static variable cannot be referenced from a static context".
I have searched for ages for a solution to no avail. Any help would be much appreciated.
Thanks in advance.