Learn programming in Java

Learn how to program in Java!

Do you want to start programming in Java? That is great! Code-Knowledge is the website if you’re going to learn the basics of programming. Java is one of the most common programming languages to start with when you want to learn how to program. Additionally, it is object-oriented, which makes it easy to build powerful programs that are easy to understand. Additionally, Java is also the language used when programming apps for Android, which makes it very fun working with Java.

The idea with Code-Knowledge is that it is simple, structured, and easy to understand. We will go through the essential steps to get started coding in Java.

  • First, you get a brief introduction to get started, followed by simple examples of mathematical operations.
  • Secondly, we will go through the if-statements, various loops and methods.
  • Additionally, how to handle a lot of data in the form of arrays and lists.
  • Then, we will look at what is called object-oriented programming; in other words, how to structure large programs using classes and objects.
  • Finally, you also get the chance to test how to code a simple game where we connect all these areas.

Learn programming in Java in a simple and fun way


Inspiration – Why should I learn to code in Java?

Chapters at Code Knowledge


  • This chapter starts with the basics of programming,
  • What to think about and how to structure your code when programming in Java.
  • Additionally, this is illustrated by simpler examples.

Data types

  • This chapter will look at the so called basic / primitive data types in Java.
  • In programs, we store data in variables where each variable corresponds to a memory location in the computer.
  • Therefore, because we can use variables over and over again, they become very useful and form the basis of programming.
  • Moreover, we will see how we can declare (create) different variables and constants, and also the differences between different data types. We will also see how we can use the variables and what possibilities and limitations they bring.

If statements

  • In the third chapter, we will look at the so-called conditions statements that make it possible to perform various operations, depending on the value of a logical (eg, boolean) expression.
  • Moreover, with the help of if, else if, else and switch, we get the opportunity to make different “choices” in our programs
  • The condition statements are the basis for a lot in programming to be able to build programs that are performing various operations depending on the conditions we specify.
  • Furthermore, a common situation when building our programs is that you want to repeat an operation several times. To do this, we use so-called iteration statements, also called loops.
  • Loops are very useful in java programming, and we will use them a lot as we create different parts/functions in our programs.
  • In this chapter, we will see how the three iteration statements, While-loop, For-loop, and Do-While loop operate and an explanation of how we can use them.
  • Finally, have a closer look at the flow charts for each loop to get an idea of how the loop will perform


  • In Chapter five, we will see how we can create methods in Java and call (use) them.
  • Furthermore, we will see that methods are a handy and powerful tool, as they are entirely independent of other codes, and we can call them can from other classes.
  • Finally, the chapter ends with a more extended example that shows how we can use several different methods when we are building our programs.

Array & ArrayList

  • The Array makes it easy to store basic data types and objects in a structured way.
  • Additionally, we will see how we can use the one-dimensional (one row) Array and also the so-called multidimensional (like a matrix) Array.
  • Finally, Chapter 6 will also explain the ArrayList. We will then see how we can use ArrayList and the differences it has towards the Array.

Classes and Objects

  • Classes and objects are the cornerstones of object-oriented programming that work together in more extensive programs.
  • This chapter explains the differences between classes and objects, how to create them, and how to reuse (inherit) classes.

Create a Game

  • We will now illustrate object-oriented programming by programming a simple game!
  • The chapter explains how you can structure your code in an object-oriented manner. We will, of course, use the knowledge we learned from the previous chapters.

Learn Python

Interested in learning programming in Python?

  • Python is easy to understand, easy to get started with and very powerful! On our site for Python here at Code-knowledge we will have a look at the basics for coding in Python!
  • Similar to Code-Knowledge Java, the idea of Code-Knowledge Python is that you should get a straightforward and easy introduction to Python
  • We go through the most basic concepts that are important to understand in programming such as data types, if statements and loops, in Python
  • Furthermore, we will also explains functions, arrays/lists and how to program object-oriented with classes and objects in Python
  • Finally, for you to easily learn and get started quickly, we have several code examples that you can use to practice

Swedish Version

Learn programming Java in Swedish

Additionally, are you Swedish speaking? In that case, we have some very good news! We have launched similar sites like Code-Knowledge in Swedish, where you can learn the basics of Java and Python.

Therefore, if you want to learn programming in Swedish, please visit: