Thread: Java codin help
View Single Post
Old 07-11-2006, 11:32 AM   #1 (permalink)
benzspida
Registered User
 
Join Date: Jun 2006
Posts: 10
benzspida is on a distinguished road
Java codin help

keep gettin 2 error messages

(1)The field greeting cannot be declared static; static fields can only be declared in static or top level types

this is what the code looks like
Code:
public class comment {
	/**
	 * @author Craig
	 * 
	 * This class demonstrates use of:<br>
	 * Line Comments<br>
	 * Block Comments<br>
	 * JavaDoc Comments.<br>
	 */
	public class CommentsExample {

		/**
		 * Program comments are nonexecuting, 
		 * statements you add to a program 
		 * documentation  for the purpose 
		 * of documentation.
		 */
		protected static String greeting = "Hi";
		
		//Program comments are nonexecuting, 
		//statements you add to a program 
		private static String name = "Guys"; //documentation  for the purpose
		
		public CommentsExample() {
			//of documentation.()
			super();
		}

		/**
		 * This is the entry point of the application.
		 *  main() is executed first by the JVM.
		 */
		public void main(String[] args) {
			/*
			 * Program comments are nonexecuting, 
		     * statements you add to a program 
		     * documentation  for the purpose 
		     * of documentation.
			 */
			System.out.println(greeting + " " + name);
		}
	}
}

Last edited by redhead; 07-11-2006 at 12:32 PM. Reason: It hurts my eyes when [code][/code] tags are missing...
benzspida is offline   Reply With Quote