Won Contests Let Us Talk Mail Me Light of Knowledge


H ello World Program
Chapter 2 : Article 1 : Hello World Program

01. Open your DOS prompt make directory workarea ,   
D:\>workarea
02. Open your Editor like notepad or I suggest u try to get Allire Homesite 5 , best for code editing , Write this program
03. You can always use color coding for your java programs , i am using the one below , its a good practice to have proper color coding , so that u can easily identify reserve words of java , and also align ur java code ,
/* My First Java Program */
class helloworld
{
	public static void main(String args[])
	{
		System.out.println("Hello World");
	}
}

Chapter 2 : Article 2 : Save , Compile and Run

01. Go to Directory D:\workarea
02. In your DOS prompt use javac to compile type in
D:\workarea>javac helloworld.java , Remember its case sensitive
03. Now java compiler creates a file helloworld.class in the same directory
04. Run the java code
D:\workarea>java helloworld
05. You must get
D:\workarea>Hello World Message


D:\>cd workarea
D:\workarea>javac helloworld.java
D:\workarea>java helloworld
Hello World



Exception in thread "main" java.lang.NoClassDefFoundError : helloworld

01. If u are a Starter in java , u may get this error some times
Exception in thread "main" java.lang.NoClassDefFoundError : helloworld
02. This error can BUG a new programmer learning java , i had this many times , i never knew how to solve this , type in
03. D:\workarea>SET CLASSPATH=
04. Remember no space after CLASSPATH , now re-execute code
05. D:\workarea>java helloworld
06. If nothing works by now Restart your system or refer sun site for handling CLASSPATH Errors

Exception in thread "main" java.lang.NoSuchMethodError: main

01. This error comes in if u forget to type in String args[]

helloworld.java '}' Expected During Compiling

01. This error comes in if u forget } or { to type in

invalid method declaration : return type required During Compiling

01. This error comes in if u forget void to type in

Cannot Resolve symbol : method printl During Compiling

01. This error comes in if u make spelling mistake printl instead of println

Next CHAPTER 3 : >> JAVA LANGUAGE FUNDAMENTALS
 My Dream to be your Friend and Create a Group of Intelligent and Understanding Programmers
     If you like this article and/or code mailme or Join our small Java User Group which is by the Programmers for the Programmers ,
Till we meet next time BYE      Kind Regards - James Smith

  Java, J2EE, J2SE and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc.
in the United States and other countries.