What is Java

A Quick Introduction

Facts

  • Designed by James Gosling at Sun
  • Simple, object-oriented, familiar
  • Robust and Secure
  • Architecture-neutral and portable
  • High Performance
  • Interpreted, threaded, and dynamic
  • 1995 Java 1
  • 1998 Java 2
  • 2004 Java 5
  • 2006 Java 6
  • 2011 Java 7
  • 2014 Java 8
  • 2017 Java 9

Nice Things

Nice things in Java.

  • Type Safety
  • Memory Management
  • No pointers
  • Multi-Threading
  • Utility Classes (Lists, Maps, IO...)
  • JavaDoc
  • Little OS dependencies
  • Bytecode magic
  • Less esoteric syntax

The Other Things

Things you might not like or enjoy.

  • Original Date and Calendar classes
  • Partially difficult Generics
  • No good UI programming support
  • Some APIs are horrible
  • Verbose syntax (in the eye of some)

How Java Works

A Computer Science Journey

Java Basics

A few words

  • Runtime engine based
  • A language that compiles but not to native code
  • Creates intermediate code that is deployed (bytecode)
  • Execution environment interprets code first
  • When code is reused often, it start to compile it on the fly to native code
  • Memory management done for you - Garbage Collection
  • Platform dependencies almost totally hidden
  • Speed is high, but not as high as native
  • Runs everywhere where a JDK exists
  • Large eco-system
  • Java spin-offs: Scala, Kotlin, Ceylon
  • JavaScript != Java; standardized JavaScript is called ECMAScript

Code becomes Code

How the code looks that is involved

public class Simple
{
    private static int add(final int a, final int b)
    {
        return a + b + 42;
    }
}

// access flags 0xA
private static add(int, int) : int
   L0
    LINENUMBER 6 L0
    ILOAD 0: a
    ILOAD 1: b
    IADD
    BIPUSH 42
    IADD
    IRETURN
   L1
    LOCALVARIABLE a int L0 L1 0
    LOCALVARIABLE b int L0 L1 1
    MAXSTACK = 2
    MAXLOCALS = 2
# {method} {0x00007f923344f2b0} 'add' '(II)I' in 'Simple'
# parm0:    rsi       = int
# parm1:    rdx       = int
#           [sp+0x40]  (sp of caller)
0x00007f9239109420: 89842400c0feff      mov       dword ptr [rsp+0fffffffffffec000h],eax
0x00007f9239109427: 55                  push      rbp
0x00007f9239109428: 4883ec30            sub       rsp,30h
                                            ;*iload_0
                                            ; - Simple::add@0 (line 6)

0x00007f923910942c: 03f2                add       esi,edx
0x00007f923910942e: 83c62a              add       esi,2ah
0x00007f9239109431: 488bc6              mov       rax,rsi
0x00007f9239109434: 4883c430            add       rsp,30h
0x00007f9239109438: 5d                  pop       rbp
0x00007f9239109439: 8505c15c5216        test      dword ptr [7f924f62f100h],eax
                                            ;   {poll_return}
0x00007f923910943f: c3                  ret