Every month many times, I am asked same question by many of my visitors (mostly beginners of course) that how to learn java. And also if I can find some time to teach java concepts ranging from core concepts e.g. object oriented principles, language keywords and syntax, to advanced concepts like multi-threading or even Spring and hibernate too. With all due respect to my fellow friends, let me say that I am already over-burdened within my personal-professional commitments. I really want to help you guys, as well as I want to learn java programming from you guys as well, but the fact is that I get very limited time after office hours, which I cannot sacrifice as I have a sweet combined family to spend some time with. Apart from family time, I spend rest of the time to write on this blog which is like passion to me and a strong medium to connect with a larger group of like-minded people.
Having said that I am writing this post dedicated to all my young (or I should say beginner) fellows who want to attain a certain level of proficiency in java technology and somewhere would like to take my advice on this. Keep in mind that if you do not like the way to learn java, I am proposing in this post, then just ignore me. Period. OR better, suggest me what you think is the better way to learn java fast or easily.
Here I am assuming the people reading this post will be, who are very new to language, so I will start by listing first thing first. Make sure you have prepared your Java development environment ready i.e. You have installed JDK/JRE and you have an IDE like Eclipse.
1) Learn the language basics
This is the first step for very obvious reason. If you don’t know the basics then you will never know either what to do next or what you are doing wrong. Initially, I do not expect from you to become the master of all java basic stuffs like keywords, core concepts or basic coding techniques. What really I expect from you is just to read all the text available in below links, even if it just doesn’t make sense to you in the first attempt. Just keep reading it.
Please keep in mind that above two links are not the only links for basic knowledge. You can do a quick google search and find out many similar links.
When you are done with few links as two given above, re-read them again second time. Don’t skip any part of it. This time, things will start making more sense to you, and you will be able to connect between various concepts by yourself. If you are still not able to connect the pieces of information spread in multiple places, then keep repeating this step until you actually start relating the core concepts. Don’t worry about you are wrong or right, just relate them and better make notes. Notes will help you to measure your java learning curve.
Carefully learn object oriented programming concepts. Just like other popular programming languages, Java is also an object oriented programming language.
2) Create some small programs
Once you are confident that you are very much familiar with most basic stuffs/keywords and concepts and you can actually relate them somehow, you are welcome to second step where you will have to start building some very very basic java programs e.g. hello world, simple addition and subtraction etc.
When you are writing the programs, keep in mind that first couple of programs are going to be real tough for you. But once you are done with them you will not face similar level of difficulty in next set of programs.
You may face difficulty so much that you may not able to type in your hello world program itself, all by yourself. Don’t hesitate, open Google and search similar program. Don’t copy it using CTRL+C. Here just read the program, and type into your IDE (integrated development environment) (I suggest to use eclipse, as I find it very easy) and solve the compilation error caused by incorrect syntax you got while typing (basically I assume that you will make mistakes in lowercase/uppercase). If you are still not able to do it, then take the help of Google again. Google is your friend, just remember it.
Do it for couple of programs and remember that always try to create program by yourself first and then use Google. I am giving below a list of basic java programs which you may consider for beginning.
- Display some text message.
- Display a list of numbers (1 to 50) each in new line.
- Find the max and min between two numbers.
- Swapping between two numbers using any technique you know.
- Build a calculator program able to add/substract/multiply and divide the numbers.
- Create two classes (super class/sub class) and practice method overloading and overriding concepts.
- Create some programs involving array e.g. printing output in array format in console.
- And so on…
Above programs are just to give you a start and make you understand what I meant by basic programs. List can be longer and I will suggest you to add more items to this list and create programs for them. And remember, Google is your friend :-)
Also use an IDE
3) Create advanced programs using Java APIs
Now when you are done with making most of the basic programs, and most importantly, you are comfortable into creating such basic programs, jump to this step. Here, I will suggest you to work hard on learning java APIs inside java collections and java IOs. Just start exploring various classes and interfaces involved into these APIs and start creating programs for them. Please note that you should always try to find an already existing API and method for doing a certain task, and you should not be creating your own logic here. Your goal is to get familiarize yourself with these APIs, so always look for a solution within these APIs only.
Again I am suggesting few basic programs you can work on to start with. Later you can include more APIs and more such programs as much as you can.
- Taking input from console and printing it
- Reading a file from filesystem and printing it’s content in console
- Creating a new file and writing some data onto it
- Reading data from a URL and do some search on it’s content
- Store elements in a list, and then iterate over it
- Use HashMap to store random key-value pairs and iterate over it in multiple ways
- Create some programs for searching and sorting over collection elements
- And so on…
The more and more programs you build at this step, you will get more and more confidence. As soon as you are good in using these APIs, jump to most important and difficult task in next section.
4) Create at least one desktop application and one web application
This step will give you the confidence which is needed to face any java interview and prove your mettle in java related discussions. Idea is simple. You just have to decide at least one java desktop/GUI application (e.g. desktop calculator), and then one web application (e.g. hospital management). And now when you have most basic knowledge at your hand, start exploring everything which you will need to build your two applications.
Ask help from experts (I will also do my bit to help you), your experienced friends, colleagues and every person you know and who can help you. Read all available good material which comes into your way when searching for solutions and simple learning the concepts. Buy some books which are related to the concepts where you are struck in. Do everything what is needed to build these application. Make them you sole objective for few days (or weeks or even months).
Let me assure you that by the time you end up completing both exercises, you will be much more confident than ever before, when it comes to java. And more importantly, it helps you to develop a habit of getting things done at every cost. This attitude is very important in long run of your career.
5) Read and participate in some good java blogs/forums
After your above four steps are completed, you will be more of a confident man who is also able to help others like you have been few month back. Find people who know less and help them in solving the problems, even if it require some amount of time of you as well. A good place for these activities can be forums like
stackoverflow.com. When you start learning about mistakes others are making, it just open up your mind on various directions and improves your thought processing capabilities.
In fact, last step is like infinite loop and you should keep doing it when the time permits. You will really appreciate the results when you will realize how mature you have become.
That’s all for now on my thoughts regarding best way to learn java. If you happen to agree with me, drop a comment. If you do not agree with me, drop your suggestion. I will include your thought into main article if it’s really good.
Happy Learning !!