How do I learn Java purely

Learning to program for beginners - which programming language?

If you are a beginner who has decided to learn programming, a very essential question arises right from the start: Which programming language should I learn first? The aim of this tutorial is to briefly introduce the various programming languages ​​and to provide assistance which is well suited for beginners to learn to program.

Our Java tutorial

Learn to code in 7 days!
20 chapters including over 65 further web tips and code download / exercises
Additionally: PDF version for download
Our tutorial is aimed specifically at beginners. You will learn all the important concepts of the Java programming language from the ground up. You will also receive the sample code for each chapter as a download, which you can then run directly on your computer. There are in-depth internet reading tips on every topic. This gives you an overview in just a few days and can then write your own small programs.

Learning to program: the programming language candidates

We'll assume that you're interested in learning a programming language that can be used to create traditional desktop applications. We will therefore leave out scripting languages ​​such as PHP and Javascript, which are used in particular to create and program dynamic websites.

The most common programming languages ​​for beginners who want to learn to code for the first time are C, C ++, and Java. C belongs to the imperative languages, while the remaining programming languages ​​mentioned belong to the genus of object-oriented languages. We will go into this distinction again in a moment.

The good news is: These 3 programming languages ​​are syntactically relatively similar, so that once you have mastered one of these languages ​​you can learn to program the others relatively quickly. To put it somewhat casually, one could say to a beginner “If you can do one, you can do all of them”. The devil is in the details, and the programming languages ​​mentioned differ a little. In order to decide which language to start with when learning to program, one should look at the differences.

Programming paradigm: imperative or object-oriented?

Imperative programming is what an inexperienced beginner might think of as programming when one wants to learn to program: a program is a sequence of commands that dictate the order in which the computer should do something. So as a trivial example: A program for calculating the sum of two numbers would consist of 4 ordered statements:

1) Read the first term A from the user 2) Read the second term B from the user 3) Calculate the sum C = A + B 4) Display the result on the screen

So imperative programming is initially quite intuitive in terms of understanding, especially with such simple examples - this naturally suits beginners who want to learn to program. However, it becomes problematic when you want to solve more complex problems and create more extensive programs: The program code quickly becomes confusing and therefore more difficult to understand and therefore difficult to maintain. For example, imagine a program like the one above, which now does not consist of 4 instructions, but of 10,000. It is clear that such a program would be very difficult for humans to survey and understand. When programming, errors would probably often occur due to the complexity and a later expansion of the program would be very time-consuming, because you first have to “think your way around” the complex program.

This is where object orientation comes into play. Everyone who wants to learn programming will come across this paradigm sooner or later, because it is currently the most widely used programming paradigm. The goal of object orientation is to solve the problem with the great complexity in large programs, which makes the programs difficult to understand.

Learn to code for dummies

Not sure where to start?
My book "Learning to program for dummies" gently introduces you to the world of programming
The book is aimed specifically at beginners in programming. The most important programming concepts are introduced carefully. You will also get to know the common programming languages ​​Java and PHP a little better. Of course, exercises and suggested solutions are also included so that you can start programming right away.

Read the first chapter here for free!

The approach to a solution is as follows: An attempt is made to divide the large overall problem that one would like to solve with a program into several smaller, in principle independent sub-problems. Now you can devote yourself to each sub-problem individually and at the end only need to combine the solutions of the sub-problems to form the overall solution. Object orientation means that you emulate a program from the “real world”: when you program, you create different objects that interact and cooperate with each other. A distinction must be made between class and object: A class combines a number of objects that have some common properties. Transferred to the real world, for example, "car" would be a class and "my Mercedes Benz year of construction 1995" an instance of the class "car", i.e. an object. This probably sounds very abstract at first and is perhaps not so easy to understand for beginners, but should be illustrated again with an example.

Imagine you want to program an application to manage a flight booking system. The main components of the program would be the “airplane” and “passenger” classes. Now specific instances can be created for aircraft and passengers, e.g. "Boeing 737 built in 1990 serial number 1300" and "Airbus 380 built in 2011 serial number 2501" for aircraft and "Erna Müller" and "Friedrich Maier" for passengers. For each aircraft, for example, the property how many free seats are available and for each passenger how much money he has spent on flight bookings is saved. Now we can, for example, have an interaction "Book a flight for 200 euros" between Airbus and Erna Müller, as a result of which there is one less space available at the Airbus property and the amount spent by Erna Müller for bookings increases by 200 euros.

As you can see in this example, objects are the focus of object-oriented programming. The objects in the program are modeled on "real" objects, which increases the comprehensibility of the programs and reduces their complexity.

If you want to learn programming, it is a good idea to forego object-orientation in the first step, since purely imperative programming is more intuitive, especially for beginners. However, once you have internalized the basics of imperative programming, you should quickly take the step to object orientation, as this has become a very important concept for programmers.

The C language does not contain any object orientation (OO). C ++, on the other hand, is object-oriented, but object-orientation is to a certain extent an "optional feature". You can also write large programs in C ++ without using OO. In Java, however, the OO is more firmly rooted, since all program code must be located within classes. Of course, you can also write programs in Java without using the OO in detail.

In Part 2 of this tutorial, we look at differences between the programming languages ​​in terms of memory management and platform dependency.

Programming with C ++ - Some of our recommendations

A complete list with a detailed description of all C ++ recommendations can be found here.

Straight to the book recommendations for C ++ or Java.

Directly to the recommendation for the C ++ correspondence course or the Java correspondence course.