The Best Way to Learn Java
You all must be aware of the fact that the first step towards learning something new involves finding out the best possible way in which to begin. This can be quite a difficult and time consuming task and often becomes the deciding factor with regards to whether or not you continue with your pursuit.
You may have found hundreds of free java learning resources around the web and have observed many different opinion about dozens of frameworks.
Finally, if you have decided to learn Java programming language, at first, you might not be clear on where to start. This is where this article will come to your rescue. It will take you through various, time tested approaches, through which, you can learn Java in the most effective manner.
How Hard Is It To Learn Java
Java is application layer programming language and is not very difficult to learn. It does not require any prior programming experince to learn java coding. Learning Java can be really easy if you already know a programming language. The fastest way to learn java is to start learning by doing it.
Step 1: Make Up Your Mind – Ignore the Critics
Not every person loves Java programming and hence, they will try their level best to deter you from learning the language. It is true that the world of programming is flooded with different competing languages and it is not really possible to pick the one which is the best. A language which works perfectly for you might not serve the same purpose for someone else.
Hence, instead of paying attention to what the critics of Java have to say, you must focus all your attention on learning the language you picked.
Step 2: Install Java and Eclipse IDE
Although, it is very much possible to learn Java simply by installing the Java SDK but the learning curve in this case is bound to be real slow. When Java SDK is combined with an IDE, it provides for an integrated development environment which will take care of all your needs and will help you learn quickly and more effectively. And among the different IDEs, Eclipse is undoubtedly the best and can be downloaded for free.
Steps to install Java SDK
- Go to Java Download Page
- Click on Download "JDK".
Steps to install Eclipse- Go to Eclipse Download Page
- Download "Eclipse IDE for Java EE Developers"
- Unzip the downloaded zip file in a folder. This should create a folder structure.
Step 3: Learn Java Fundamentals
The most logical way in which you can start learning Java is to start with the fundamental concepts. In order to learn the basics of this programming language, you can make use of a free tutorial or can simply download a good e-book. The whole idea is to understand what core Java is all about before moving on to the advanced levels.
Some of the key concepts you must learn are
- Object Oriented Programming Concepts including encapsulation, abstraction, inheritance, containment and polymorphism.
- Why Java is Platform Independent? Why it can be easily run on all operating systems like Unix, Windows or Mac?
- What is Java Virtual Machine? How Java Virtual Machine works?
- Understanding of Java Collection framework
- Good understanding of data types and few java.lang classes like String, Math, System, java.io stream concepts etc.
Step 4: Read Some Good Books from Experts
Although, the online e-books as well as tutorials will help you learn Java in a very effective manner, looking at the language from the point of view of an expert will help you a great deal. For this, start reading books which have been penned down by expert Java programmers and professionals. This will help you gain an insight on the process of coding, as is done by experienced programmers.
My choice of Free book is Thinking in Java
You can also buy a printed copy of Thinking in Java on amazon. In case you are looking for different good options, here are few awesome java books that I recommend.
Step 5: Start Creating a Simple Application Using Your Knowledge
Learning only the theoretical concepts of Java will not help you become a programming expert. For this, you will be required to put the theory into practice as well. So, make use of the knowledge acquired by you and start creating a simple application. You can go for some simple coding exercises which will keep your motivation levels high.
By simple I do not mean a “Hello World”. I would recommend some exercises like below
Try some logic exercises like
- Compute factorial of a number.
- Create a Fibonacci series.
- Find all prime numbers between 1 to 1000
- Print number in word (e.g. 123 = One Hundred Twenty Three)
Try file input/output exercises like
- Read a file and display its content on console.
- List all files in a directory.
- Create a file with some content.
- Read input from user on console.
Try String manipulation exercises like
- find a string in large text.
- replace a part of string
- parse numbers from strings
You can find out few more exercises at Java Basic Exercise
Step 6: Go Next Level – Simple is not Enough
Once you are through with basic Java coding exercises and have gained a comfort level in the usage of this language, you can move on to the next level and start creating programs and applications which require more complex and advanced levels of programming. By doing this, you will get a good exposure of the real life complexity that a programmer faces.
At this level, I would recommend some exercises like below
- Build a number pyramid of any size based on input size.
- Try creating a small text based 2 player game (like Tic Tac Toe)
- Add a twist to the Tic Tac Toe with a Computer player option, where the computer can make one move and second player is human. You will easily be able to figure out the strategy to win this game by now :)
Step 7: Learn Servlets and JSP
A web application is basically a dynamic extension of the application server or web. The introduction of Java EE 6 has resulted in a lot of improvement over the previous versions, in terms of adding good standard APIs like servlets and JSP. Learning these additional APIs will help you venture into new things and integrate your Java programming with additional frameworks and tools.
Once you understand servlets and JSPs thoroughly, I would recommend some exercises like below
- Build a application to capture user details in a form, save the form detail in MySQL database using JDBC.
- Build a simple web based Tic Tac Toe game that two players can play.
- Add authentication to the above game with allowing only users with username/password.
Step 8: Learn JSF
JSF or JavaServer Faces is basically a web framework which helps in the simplification of user interfaces when it comes to Java web applications. This is done through the assembly of reusable components within a page. Additionally, it comes with many popular functions like manipulating and accessing components through tag libraries, automatic saving of form data along with its re-population on getting displayed at the client side.
Once you understand JSF thoroughly, I would recommend some exercises like below
- Build a simple web based chatting application
- Build a simple shopping cart application
Step 9: Build an Awesome Web Application
These may be of two different types, namely, presentation oriented or service oriented. Depending upon what you want, create an awesome web application by making use of web components you have learned so far.
At this point, I would also recommend you to start looking into some of good JSF frameworks like below, each of them may be a good fit for different needs.
Step 10: Continue Learning and keep up with the Latest Trends
Finally, if you are a programmer, you cannot really get away with learning. This is because there is absolutely no place for obsolete professional skills in the world of programming. Hence, it is very important for a Java programmer to keep up with the latest trends in order to gain a competitive edge over others. And, the best way to do this is by putting newly acquired knowledge into practice.
I recommend reading these Java and related Technology Sites and Blogs from experts
Java is a programming language which can be learned for fun and also has the potential to make you stand out as an effective programmer. Hence, depending upon where exactly you want to reach, choose a programming language which suits you the best. This article is solely based on my personal Java learning experience over a decade and hope you will be able to get benefited from my experience.