Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Java - Behind The Scenes

Java - Behind The Scenes

A brief introduction to the key concepts of behind the scenes working of a Java program.

** This presentation is a part of the Java Tutorial series by RSpeaks **

RSpeaks

May 13, 2013
Tweet

Transcript

  1. Key Terms Source Code Source code refers to the actual

    high level language code written using an IDE or any given text editor. The source code file should always be saved with a .java extension. Example code:- public class HelloWorld { public static void main(String ar[]) { System.out.println(“Hello”); } } Save file as HelloWorld.java 2
  2. Key Terms Byte Code Instead of compiling the code directly

    into its native executable code Java compiles the source code into an intermediate byte code. This file is generated automatically with a .class extension, after the source code is compiled successfully. Example code:- 3 public class HelloWorld extends java.lang.Object{ public HelloWorld(); Code: 0: aload_0 1: invokespecial #1; //Method java/lang/Object."<init>":()V 4: return public static void main(java.lang.String[]); Code: 0: getstatic #2; //Field ...contd Automatically generated file HelloWorld.class
  3. Key Terms Java Runtime Environment Java Runtime Environment (JRE) is

    a combination of – Java Virtual Machine (JVM) – it is a program that accepts the byte code (i.e. the .class file) and converts them to native executable code (binary code). JVM also includes other components i.e. memory management, just in time compiler and byte code verifier. Java API – these are a set of standard reusable class libraries made available in byte code format that provides a set of additional functionalities. 4 Native Code Every machine at its base only understands binary code. Native code is thus the actual executable code that delivers the final output under a given operating environment.