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 !!

Was this post helpful?

Join 7000+ Fellow Programmers

Subscribe to get new post notifications, industry updates, best practices, and much more. Directly into your inbox, for free.

26 thoughts on “Best Way to Learn Java Programming”

  1. Hi Mr. Lokesh Gupta! My name is Ayushiyer one of the java course beginner. I have already completed the C and C++ course last month. So I thought next to move on to Java and Data structure algorithm. My friends also asked the same question so many time to me as to how you will learn Java course without going to tutorial classes. I found your article which was well-explained and very inspirational blog thank you for this wonderful article. I decided to learn java online only…

    Reply
  2. Hi Lokesh,

    Need to start Data Structure and Algorithms in Java. Can you suggest book or online site to get good hold on this subject.

    Reply
  3. In most interview they ask A to Z Questions and programs, but they give unworthy work in projects. So over period of time we will loose grip over programming and need to start from scratch to prepare for interviews. How to overcome this situation?

    Reply
  4. hey ,
    Great article this is. As Beginner it will definitely help me to learn java.The best thing you have explained in 1st point is try to read all the text , read basics that is what important for new learner.Thanks for your awesome guide.

    Reply
  5. Thanks lokesh, for sharing the way of learning java. For every java programmer know this basic steps and don’t burtify the classes and interfaces at the initial level, people wants to understand API throughly and grab the things how the java people designed the API like that.

    Reply
  6. 3) Create at least one desktop application and one web application…..this point is very imp… without developing your own web application or desktop application it’s hard to face any interview..

    Reply
    • this is really interesting article to learn java very speedily or easily. Some time we have to pay money online to learn java.

      Reply

Leave a Comment

HowToDoInJava

A blog about Java and its related technologies, the best practices, algorithms, interview questions, scripting languages, and Python.