Learning Java Programming Language - Day 1

I am Learning Java programming language these as its part of my course. Java is Object-oriented, structured, imperative language. Its syntax(grammar) is heavily inspired  from  C/C++. All those coders who have know basics of C/C++ won't have much problems in learning java. Sun Microsystems defines java as _The Java programming language is a high-level language that can be characterized by all of the following buzzwords: _Simple,Architecture neutral,Object oriented,Portable,Distributed,High performance,Multithreaded,Robust,Dynamic,Secure

The main Advantage of Java is Portability, the code written in java can run on different platforms; independent of OS its coded. It can run on various platforms since its does not directly access the Host OS's libraries and API's . All code written in java is first compiled to bytecode by java compiler(javac) and the java launcher tool runs your application instance in Java Virtual Machine(JVM).This method of running program allows programs to be platform independent as your code never comes in direct contact with host OS's programming API. a mediator called Java Virtual Machine(JVM) with help of Java Application Programming Interface (API) automatically converts bytecode into machine readable code. The main disadvantage of Virtualization technique is that it sacrifices on performance for portability. Java Applications are resource intensive and are slower than native applications. For example Vuze(Formerly known as Azureus) is  bittorrent Client entirely coded in java. it needs minimum of 256mb Memory and lots of CPU time. it runs on Windows,Mac OS,Linux etc. However its counterpart _µTorrent _runs exclusively on Windows platform and takes marginal resources. As a Developer when choosing which programming language to code your application in  you have to decide between speed & portability.Java is highly portable so it should be used in making web applets and writing big applications in java should be generally avoided.

Writing First Program in Java

Before we can proceed writing famous "Hello World" program, we need to setup environment accordingly. for coding in any High-level programming language we nee three basic things compiler,Text editor and Shell. for java we would need

Download JDK from here(74mb). Notepad++ from here(2mb). please note confuse notepad++ with windows notepad, both are entirely different. you can write your programs in notepad as well but windows notepad does not support basic programming functions like syntax highlighting. So its wise to use Notepad++. Installing JDK and notepad++ is real easy, its typical Next,Next,Next Wizard. after you finish installing Next Step is to open Notepad++ and type the following code.

public class hello
        public static void main (String args[])
            System.out.println("Hello World. My First Java Program!");

Now save the file with .java extension and click on "Show console Dialog" icon from Standard toolbar in Notepad++. type cmd and you will get Windows Command Shell. Compling the program

  javac filename.java

Running the Program

  java filename

make sure you are in dir where the file exists. ScreenShot:


you can also use a Integrated Development Environment(IDE ) like Eclipse which has a Text editor,Complier and Shell integrated into one application. its bit more complex and is more usefull in coding large applications. 

For online resources on Java have a look here, here & here. For java Books try Java™ Programming Language by Arnold, Ken/Gosling, James/Holmes, David and  Effective Java by Joshua Bloch

Wish you make fastest applications with little bugs Happy Programming!