Monday 10 September 2012

Starting with JAVA


Java is open source platform to develop Web and Mobile Applications, in this post we are here to give basic you introduction about java and why we are learning Java, you also get answer how to create java program in this section. Beginners generally believes that java is difficult to learn and very complex to understand in compare to C and CPP. but we want to inform you that starting phase of java will defiantly difficult but when you practice daily and take more interest into Java , you will realize that 'Java is easy' because java has rich set of inbuilt functionality that makes programming easy to do and more faster.. So let's Start with Java, Just do it  :)


what is Java ?

Java is a programming language and computing platform first released by Sun Microsystems in 1995,
First version of java was released in 1996. Since then java has been very popular language for the web. Due to its use in the World Wide Web, a lot of people seem to think that Java is meant exclusively for developing application on the Web. However despites its popularity in Web application, Java is general purpose programming language, and it is not meant exclusively for the Web.

why Java?


Java programming language has number of features that makes it the language of choice for the most developers.
The primary reasons for the popularity of Java are as follows:
  • Java is platform independent.
  •  Java is an Object Oriented Programming Language.
  • Java provides applets and servlets for use on the Web.
  • Java is Easy

Downloading Java, it's Free!

Java is free, you can download latest version of Java it from here:
Process of installing Java is here :
http://www.java.com/en/download/help/windows_offline_download.xml

To write Java code, you need editor. you can use simple notepad but it will be difficult to code in it. so we prefer Notepad++ (NPP), it is customized for codding purpose in all Languages.
Download Notepad++ from FileHippo.com

Process of Set Path of Java

You can run the JDK without setting the PATH environment variable, or you can optionally set it so that you can conveniently run the JDK executable files (javac.exe, java.exe, javadoc.exe, and so forth) from any directory without having to type the full path of the command. If you do not set the PATH variable, you need to specify the full path to the executable file every time you run it, such as:

C:\> "C:\Program Files\Java\jdk1.7.0\bin\javac" MyClass.java

It is useful to set the
PATH variable permanently so it will persist after rebooting.
To set the PATH variable permanently, add the full path of the jdk1.7.0\bin directory to the PATH variable. Typically, this full path looks something like C:\Program Files\Java\jdk1.7.0\bin. Set the PATH variable as follows on Microsoft Windows:
  1. Click Start, then Control Panel, then System.
  2. Click Advanced, then Environment Variables.
  3. Add the location of the bin folder of the JDK installation for the PATH variable in System Variables. The following is a typical value for the PATH variable:
C:\WINDOWS\system32;C:\WINDOWS;
C:\Program Files\Java\jdk1.7.0\bin
Note:
  • The PATH environment variable is a series of directories separated by semicolons (;) and is not case-sensitive. Microsoft Windows looks for programs in the PATH directories in order, from left to right.
  • You should only have one bin directory for a JDK in the path at a time. Those following the first instance are ignored.
  • If you are not sure where to add the path, add it to the right of the value of the PATH variable.
  • The new path takes effect in each new command window you open after setting the PATH variable.

Creating Sample Java Program

Every programmer knows what will be the first program to learn any programming language..yes it’s ‘Hello World!’. So let's go for it

class TestHello
{
public static void main( String args[] )
{
System.out.println("Hello! i start with Java");
}
}

for code discription : http://docs.oracle.com/javase/tutorial/getStarted/application/index.html

in above program we have created one class names 'TestHello'. saved this code in File with extension '.java' like 'TestHello.java'. ( it's not must that filename should be same as class name ), Remember the location of java file.

Compile and Run Java program

To compile: open command prompt, navigate to directory where you have saved java file, in our example that is 'C:\'.
 type javac command and file name to compile, if an error in program it will show you. if successfully compiled , it will generate .class file

To run : type java and class name. it displays output


C:\>javac TestHello.java
C:\>java TestHello
 Hello! i start with Java

To understand How Java program excecutes refer below post:

http://iamlearninghere.blogspot.com/2012/09/process-of-java-program-execution.html

for detail Learning : References


Hope this details help you to know about basic Java, Comment your feedback about this post.
if you have any reference you think that will help student to learn Java,  please mention links in comment section. Thank you in Advance.

Keep in mind that everything is easy , we have to just keep interest in it.
KEEP LEARNING ..... Have A Good Day :)

Kindly Bookmark and Share it:

0 comments :

Post a Comment

Any Query ? any suggestion ? comment here

 

Recent Post

Recent Comments

© 2010 IamLearningHere Template by MBT