Friday, February 6, 2009

Self Java Training is possible, possible and possible. What are the steps ?

Where do I start? Do I need any tools? I mean, How do I setup Java on my machine?

I am reading and reading but nothing is getting into my head !! If that is how you feel, read on. Best way to learn Java, or for that matter any programming language is by writing and running small examples.

Learn how to setup. Then, how to write, compile and run a simple Java Program that prints Hello on the screen or command prompt. You can do this by following one of the following approaches:

  1. Use JDK (Java SE Development Kit) and Notepad.
  2. Use JDK (Java SE Development Kit) and Eclipse software (Free) or any other software that you are comfortable with to type your program.

Approach 1:
1. Download and install latest JDK from http://java.sun.com.
2. Write your program(may be simple hello world) in Notepad and save the file.
3. JDK
has a bin directory that has javac.exe (compiler) which is used to compile the program and java.exe that is used to run the program. Use them to compile and run the program, respectively. If you saved your program as App. java,
Command to compile:
javac.exe App.java’
This will App. class which is used to run the program.
Comand to run:
‘java.exe App’
You will see “hello world” in the output or at command prompt.

Approach 2:
1. First, download and install latest JDK from http://java.sun.com.
2. Download and install latest Eclipse software from www.eclipse.org.
3. Create a Java Project in Eclispe.
4. Create a java class under the source folder (src).
5. Run progrfam. If App.Java is the file that contains your program, right click it and Run as Java Application. You will see “hello world” in a window called console.
Note: Eclipse uses javac.exe and java.exe from the JDK installed to compile and run the java program, respectively. It keeps compiling the code automatically.

Sample Program:
File Name: App.java
public class App{
public static void main(String[] args){
System.out.println(“hello”);
}
}

This should arm you with 90% of the things you would need to learn Java. Use any Java Book or just use Tutorials at http://java.sun.com. for additional help.

In the next few days, write and understand simple java programs that have one Java class. Try and learn some of the about 45 keywords that Java language has.

Now, try and write multiple Class programs. After some time you might want to use some of the classes already available in the java library. This library is already installed when you installed JDK. But to know about the Classes available you would need documentation to that library which is popularly known as JAVA API. Google for "JAVA API" to find the documentation online (Its made available at http://java.sun.com.).

To be more effective try and follow the following path of topics:

Java Fundamentals
  • Primitive types, Statements and Arrays.
  • Method calls, method input output, Flow of Control
  • Classes, Objects, fields, constructors, methods, package and import
  • Scope of Variables: local variable, object variable, input parameter
  • Modifiers: private, default, protected, public, final and static
  • Command prompt: compile, run, jar, use String args[]
  • Console Input/Output: Scanner, Understanding System.out.println()

Object Oriented Program Design
  • Inheritance, Encapsulation and Polymorphism (Overriding and overloading)
  • Constructors: default and overloaded constructors, super and this
  • Interfaces and abstract classes
  • Relations between Objects: "Has a" and "Is a"
  • Exceptions
  • Usage of collections: ArrayList, HashMap, Iterator, LinkedList

At this point you know Object Oriented way of programming.

Now learn important parts of the Java API:

  • File IO and Serialization
  • GUI AWT
  • GUI SWING
  • Sockets
  • Threads
  • JDBC

After covering the above topics, you would be in quite a good position to dive on to the server side of the java programming. Install a free web server like Tomcat and write your first JSP and first Servlet with help from some tutorial, some book, tutor, a Java Training Course or any other source you can think of.

The above is for self learning. It may take time. But if you are in a hurry, you might need help from a Java Tutor or might want to take up a Java Training Course. Java Training can speed up the travel down this path. It can give a deeper and wider knowledge of the core java concepts and important library/API in a shorter time. Java Training can bring some discipline, timeliness and focut to the Java learning. Java Training in core java can quickly bring you to a step where you can then learn server side Java. Weather you learn yourself or receive Java Training, your drive to learn and the instructor’s drive to teach matter a lot more than anything else.

Bharat
CEO & Expert Java/JEE Trainer
Java Training at javasprint.com
Get a jump start.

No comments:

Post a Comment