Sunday, 20 September 2015

Before starting : A few words

Hi,

I know you are very much excited to learn a new programming language and could not hold back to start coding in Java. But before diving in we should build a level of motivation from where you will not come down.

The best thing about you learning Java is that its arguably, the best programming language. Dating back to 1995 till today Java has touched every sphere of life. Currently, Java is used in internet programming, mobile devices, games, e-business solutions etc. 

There are given the major points that describe the history of java.
  1. James GoslingMike Sheridan, and Patrick Naughton initiated the Java language project in June 1991. The small team of sun engineers called Green Team.
  2. Originally designed for small, embedded systems in electronic appliances like set-top boxes.
  3. Firstly, it was called "Greentalk" by James Gosling and file extension was .gt.
  4. After that, it was called Oak and was developed as a part of the Green project.


Why Oak name for java language?

  1. Why Oak? Oak is a symbol of strength and chosen as a national tree of many countries like U.S.A., France, Germany, Romania etc.
  2. In 1995, Oak was renamed as "Java" because it was already a trademark by Oak Technologies.



Why Java name for java language?
  1. Why they choose java name for java language? The team gathered to choose a new name. The suggested words were "dynamic", "revolutionary", "Silk", "jolt", "DNA" etc. They wanted something that reflected the essence of the technology: revolutionary, dynamic, lively, cool, unique, and easy to spell and fun to say.
  2. According to James Gosling, "Java was one of the top choices along with Silk". Since java was so unique, most of the team members preferred java.
  3. Java is an island of Indonesia where first coffee was produced (called java coffee).
  4. Notice that Java is just a name not an acronym.
  5. Originally developed by James Gosling at Sun Microsystems (which is now a subsidiary of Oracle Corporation) and released in 1995.
  6. In 1995, Time magazine called Java one of the Ten Best Products of 1995.
  7. JDK 1.0 released in(January 23, 1996).


Java Version History


There are many java versions that are released. Current stable release of Java is Java SE 8.
1.     JDK Alpha and Beta (1995)
2.     JDK 1.0 (23rd Jan, 1996)
3.     JDK 1.1 (19th Feb, 1997)
4.     J2SE 1.2 (8th Dec, 1998)
5.     J2SE 1.3 (8th May, 2000)
6.     J2SE 1.4 (6th Feb, 2002)
7.     J2SE 5.0 (30th Sep, 2004)
8.     Java SE 6 (11th Dec, 2006)
9.     Java SE 7 (28th July, 2011)
10.   Java SE 8 (18th March, 2014)

Java has been all time favorite of programmers including me ;) during last decade. By deciding to learn Java you have decided to rule the programming world.

Keep smiling & keep reading...

Amit Kumar


Hello World & Exercises

Hi,

Verify Java

I hope you have successfully installed Java and eclipse and set up you environment.
To check if you have done that correctly open Command Prompt,

  1. Type java -version and verify that you get the version information of java installed on your machine.
  2. Check below image.


Getting familiar with eclipse

Check below image,
  1. This is the perspective that is open right now in eclipse. We need Java for this tutorial.
  2. This is Project explorer, where you can see all the projects and files within the project in a hierarchical fashion. 
  3. This is main window where you will see opened files and write you code.
  4. This is a list of views which will be handy later soon.
  5. Status of what eclipse is doing right now.


OK, so now we are good to go.

Create Hello World!

  1. Click on File -> New -> Java Project
  2. Type MyFirstJavaProject and Click Finish button at the bottom.
  3. Check below image

  1. Click small arrow symbol as shown in below image.
  2. Right Click on src folder and select New -> Package.
  3. Type your package name as myCode.
  4. Click Finish button at the bottom.


  1. Right click on myCode package that we just created.
  2. Select New -> Class.
  3. Type your class name as HelloWorld.
  4. Click Finish button at the bottom.


  1. Congrats, now we will write some code to make our class do something for us.
  2. For now we want it to print Hello World!
  3. Double Click on HelloWorld.java file that we have just created.
  4. You will see it has some code as shown below.
Old Code:

package myCode;
public class HelloWorld {
}

New Code:

package myCode;
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}

I will explain the code later but for now just write it and run it.

  1. To run the code right click on the class file you want to run and select Run As -> Java Application.
  2. A console view will show up with output as Hello World!
  3. Voila, you have done it.


Some Exercises for you

  1. Print your name instead of Hello World.
  2. Print your friends' or siblings name.
  3. Print your favorite quote or mantra.

Keep smiling & keep reading...

Amit Kumar

Saturday, 19 September 2015

Getting Started..

Hi,

I highly recommend you to go through this page once.
In order to start coding in Java you will need following:

  1. Java Compiler
  2. Integrated Development Environment tool
  3. A Computer (lol)

Java Compiler

  1. Go to JAVA-8 and download the latest JDK for your machine. 


Integrated Development Environment tool

  1. Go to Eclipse and download the latest eclipse for your machine.


Setting up Environment Variables

  1. Set up JAVA_HOME as JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_27 where you give path to the jdk. Java_home is an environment variable that holds the path information to look for JDK on that machine.
  2. Run following commands to set JAVA_HOME and update Path variable on your machine.  

  • SET JAVA_HOME = C:\Program Files\Java\jdk1.8.0_27 
  • SET PATH = %PATH%;%JAVA_HOME%\bin

That's it, you are now ready to write your first Java program.

Keep smiling & keep reading...



Amit Kumar