Introduction to Programming

The Infinite Java Training

René Schwietzke, Xceptance


This will be more than just Java.

  • Learn the x86 architecture basics
  • Learn programming basics
  • Learn Java and OOP
  • ... and more.

Programming is like writing books. Not every book is good, not every book will make you famous, not every book will earn you enough.

But a lot of people think they can write a book... cannot be that hard, can it?


This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

c b a


The Classic Way to Write Programs


The most basic way to write a program.

# Machine Code
b8    21 0a 00 00   #moving "!\n" into eax
a3    0c 10 00 06   #moving eax into first memory location
b8    6f 72 6c 64   #moving "orld" into eax
a3    08 10 00 06   #moving eax into next memory location
b8    6f 2c 20 57   #moving "o, W" into eax
a3    04 10 00 06   #moving eax into next memory location
b8    48 65 6c 6c   #moving "Hell" into eax
a3    00 10 00 06   #moving eax into next memory location
b9    00 10 00 06   #moving pointer to start of memory location into ecx
ba    10 00 00 00   #moving string size into edx
bb    01 00 00 00   #moving "stdout" number to ebx
b8    04 00 00 00   #moving "print out" syscall number to eax
cd    80            #calling the linux kernel to execute our print to stdout
b8    01 00 00 00   #moving "sys_exit" call number to eax
cd    80            #executing it via linux sys_call
; Assembler

section     .text
global      _start                      ;must be declared for linker (ld)

_start:                                 ;tell linker entry point

    mov     edx,len                     ;message length
    mov     ecx,msg                     ;message to write
    mov     ebx,1                       ;file descriptor (stdout)
    mov     eax,4                       ;system call number (sys_write)
    int     0x80                        ;call kernel

    mov     eax,1                       ;system call number (sys_exit)
    int     0x80                        ;call kernel

section     .data

msg     db  'Hello, world!',0xa         ;our dear string
len     equ $ - msg                     ;length of our dear string

A Piece of Linux

A few kernel lines...

 * frame_vector_to_pfns - convert frame vector to contain pfns
 * @vec:	frame vector to convert
 * Convert @vec to contain array of pfns.
void frame_vector_to_pfns(struct frame_vector *vec)
	int i;
	unsigned long *nums;
	struct page **pages;

	if (vec->is_pfns)
	pages = (struct page **)(vec->ptrs);
	nums = (unsigned long *)pages;
	for (i = 0; i < vec->nr_frames; i++)
		nums[i] = page_to_pfn(pages[i]);
	vec->is_pfns = true;

High-Level Languages

Just a quick overview

In computer science, a high-level programming language is a programming language with strong abstraction from the details of the computer. In comparison to low-level programming languages, it may use natural language elements, be easier to use, or may automate (or even hide entirely) significant areas of computing systems (e.g. memory management), making the process of developing a program simpler and more understandable relative to a lower-level language. The amount of abstraction provided defines how "high-level" a programming language is.

Language Examples

// Java
class HelloWorld {
    public static void main( String args[] ) {
        System.out.println( "Hello World!" );
// Kotlin
fun main(args : Array<String>) {
    println("Hello, world!")
// Scala
object HelloWorld extends App {
    println("Hello world!")
# Perl
print "Hello World!\n";
// C++
#include <iostream>

int main() {
    std::cout << "Hello World!" << std::endl;
// JavaScript
console.log("Hello World");
// C#
class HelloWorld {
    static void Main() {
        System.Console.WriteLine("Hello, World!");
// Ceylon
print("Hello, World!");
// Go
package main

import "fmt"

func main() {
    fmt.Printf("Hello World\n")
# Python
print("Hello World")

Continue to...

What is Java?