Best Way to Learn Java Programming

Every month, I am asked the same question by many blog visitors (primarily beginners) about learning Java.

I am writing this post dedicated to all my young fellows (or I should say beginners) who want to attain a certain level of proficiency in Java technology and where they would like to take my advice.

If you do not like my suggested way to learn Java, ignore this post and continue with what suits you best. Even better, suggest to others what you think is better to learn Java fast or quickly.

Lets start by listing first thing first. Make sure you have prepared your Java development environment, i.e., You have installed JDK/JRE and an IDE like Eclipse.

1. Learn the Language Basics

This is the first step for a self-evident reason. If you don’t know the basics, you will never know what to do next or what you are doing wrong.

Initially, I do not expect you to become the master of all basic java concepts like keywords, core concepts or basic coding techniques. What I expect from you is just to read all the text available in the below links, even if it just doesn’t make sense to you in the first attempt. Just keep reading it.

  1. http://docs.oracle.com/javase/tutorial/java/nutsandbolts/
  2. Java Tutorial

Please keep in mind that the 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 a few links as the two above, re-read them again the second time. Please 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 can still not connect the pieces of information spread in multiple places, keep repeating this step until you start relating the core concepts. Don’t worry about you are wrong or right; connect 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. Start to Code with Small Programs

Once you are confident that you are familiar with the essential keywords and concepts and can relate them somehow, you are welcome to the second step. Here you will have to start writing some fundamental java programs e.g., hello world, simple addition and subtraction etc.

When writing the programs, keep in mind that the first couple of programs will be adamant for you. But once you are done with them, you will not face a similar level of difficulty in the next set of programs.

You may face difficulty so much that you may not be able to type in your hello world program, all by yourself. Don’t hesitate, open Google and search for similar programs.

Remember. Don’t copy and paste the programs from any source or webpage. Just read the program, and type it into your IDE yourself. 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 retake the help of Google. Google is your friend; remember it.

Do not copy and paste the programs into IDE. Type the program and solve all compilation and runtime errors, yourself.

Please do it for a couple of programs and remember that always try to create a program by yourself first and then use Google. I am giving below a list of basic java programs which you may consider for the 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…

The above programs give you a start and make you understand what I meant by basic programs. The list can be long, and I suggest you add more items to it and create programs for them.

And remember, Google is your friend :-)

3. Learn Java APIs and Write Few Complex Programs

When you are done with making most of the basic programs, and most importantly, you are comfortable creating such basic programs, jump to the next step.

Here, I suggest you work hard on learning Java APIs inside java collections and java IO. Just start exploring various classes and interfaces involved in these APIs and start creating programs for them.

Please note that you should always try to find an existing API for doing a particular task, and you should not be creating your logic here. Your goal is to familiarize yourself with these APIs, so always look for a solution within these APIs only.

Again I am suggesting a 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 at using these APIs, jump to the next section’s most essential and challenging task.

4. Create One Desktop Application and One Web Application

This step will give you the confidence needed to face any java interview and prove your mettle in Java-related discussions.

The idea is simple. You have to decide on at least one java desktop/GUI application (e.g., desktop calculator) and one web application (e.g., hospital management). And now, when you have the 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 that comes your way when searching for solutions and learning the concepts. Buy some books which are related to the concepts where you are stuck in. Do everything that is needed to build these applications. Make them your sole objective for a 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 the long run of your career.

This helps you build a habit of getting things done, at every cost.

5. Participate in Good Java Blogs and Forums

After your above four steps are completed, you will be more of a confident man who can also help others like you were a few months back.

Find people who know less and help them solve the problems, even if it requires some amount of time for you. A good place for these activities can be forums like stackoverflow.com. When you start learning about mistakes others are making, it just opens up your mind in various directions and improves your thought processing capabilities.

In fact, the last step is like an infinite loop, and you should keep doing it when the time permits. You will appreciate the results when you will realize how mature you have become.

That’s all for now on my thoughts regarding the best way to learn Java. If you happen to agree with me, drop a comment. If you disagree with me, drop your suggestion. I will include your thought in the main article if it’s really good.

Happy Learning !!

Comments

Subscribe
Notify of
guest
24 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.

Our Blogs

REST API Tutorial

Dark Mode

Dark Mode