How to Program in Java

To program in Java (not JavaScript, an unrelated language), you need a compiler, a program to convert Java source code to bytecode. In the old days, the only option was Sun's JDK; but now you have many options, including the GNU GCJ which creates class files or native exe files, and jikes, IBM's open source contribution. You also will need a Java virtual machine, which is a "machine within a machine" which understands Java bytecodes and translates them into machine language on the target processor. There are many available, but you can never go wrong with the javac compiler and java JRE virtual machine included with Sun's Java standard edition.

Steps

1. Download the correct package for your platform. Windows and Solaris users should visit Oracle's Java SE page to download a package, Macintosh users will find they already have the Java SE installed. For maximum portability, it may be better to get an older edition; not all your potential users will have the latest JVM installed. Alternatively, use an open-source or other third-party compiler such as GCJ or jikes, and compile to a native executable or run it with the Java JRE.

2. Learn to use an IDE. Eclipse and NetBeans are two of many other IDEs that are here to help us write the code easier -- they report any errors as you code, they help with methods, imports and many more.

3. Learn Edit-Compile-Test cycle. You should start with the Hello World program.

4.  Create your own or edit other people's class(es).

5. Compile to class file(s)

6. Run the program with the Java executable, or as an applet in a browser. If the functionality isn't correct, or you want to add more features, start again at step 1.

7. If you can afford it, buy a good book about Java programming and carefully read the beginning. With this language, the beginning is more difficult than later steps.

8. Check out sites such as Cksstudios.com, Javacooperation, Cokeandcode and Oracle's website for resources/tutorials.

9. Take advantage of the object oriented paradigm. Learn how to use inheritance, classes, polymorphism and encapsulation to increase the efficiency of your code. Being object oriented is one of Java's strong points, so use it fully.

10. Read up and follow a Java tutorial (one of the first recommended tutorials could be a tutorial on collections).

11. For specific info on the classes, methods, and variables, visit Oracle's API

Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here Click here 

12. If you face any problems, always try a web search. There are a lot of good articles about Java on the web.

13. Don't reinvent the wheel. Java was always about reusing open-source libraries. If you need something that is not commonly used, there's usually a library that helps you. Check Java-Sources and Ohloh

thank you keep visiting

original post : How to Program in Java

0 comments: