Java Fundamental period - Lecture 4

Java environment, compilation, execution | logic and operations in Java

Summary of the last lecture

How Java handles the produced code execution?

Java environment: the JVM

Java environment: the JVM (2)

Pro and cons of a Virtual Machine system

Java environment: the JVM (3)

From design to compilation

From compiled classes to execution


Compilation and Execution in Eclipse (1)

Eclipse hides some compilation operations :

Compilation and Execution in Eclipse (2)

Eclipse build options : Right click (Project) > Build Path > Configure Build Path

Compilation and Execution in Eclipse (3)

Eclipse gives shortcuts for

Compilation and Execution in Eclipse (4)

In order to be executable, your class must have a static main method
First execution
package fr.tbr.exercises;

public class JavaSyntaxDemo {
     private String demoVersion = "1.0_DEV";

     public JavaSyntaxDemo() {

     public String getDemoVersion(){
        return this.demoVersion;

     public static void main(String[] args){
    	 System.out.println("=> Begin execution");
    	 JavaSyntaxDemo demo = new JavaSyntaxDemo();
    	 System.out.println("Working with version : " + demo.getDemoVersion());
    	 System.out.println("<= Exit");

Console applications : in and out

Exercise: Bank Account System

Exercise 2: Bank Account System, user input

In the former exercise, replace the programmatic initialization by a user input

Conditional statements in Java : Tests

Conditional statements in Java : Switches

Exercise 3: Calculate the perimeter and the area of different figures

Create methods which get the appropriated parameters to calculate area and perimeter of :
And display those results in the standard output