01 Introduction
01 Introduction
Introduction
Ziyati Houssaine
29. September 2020
Java
1
Overview
1. Proceeding
3. Basics
Some definitions
Calculating
Text with Strings
2
Proceeding
About this course
Requirements
Proceeding
3
About Java
Pros:
4
About Java
Cons:
5
Your first program
Hello World
DEMO
6
Creating your Working Environment
7
Hello World!
This is an empty JavaClass. Java Classes always start with a capital letter
1 public class Hello {
2
3 }
8
Hello World!
9
How to run your program
save your program by pressing ’esc’, then ’:w’ exit vim by typing ’:q’ (and
hit return) then:
1 javac Hello . java
2 java Hello
3
10
Hello World in an IDE
DEMO
11
Setting Eclipse or netbeans
12
Basics
Comments
13
Code concepts
14
Code concepts
15
Primitive data types
16
About the Semicolon
17
Blocks
18
Naming of Variables
19
Calculating with int i
20
Calculating with int ii
21
Calculating with int iii
Addition a + b;
Subtraction a - b;
Multiplication a * b;
Some basic mathematical operations: Division a / b;
Modulo a % b;
Increment a++;
Decrement a--;
22
Calculating with float i
23
Calculating with float ii
24
Mixing int and float
25
Strings
26
Concatenation
You can concatenate Strings using the +. Both printed lines look the
same.
27
Strings and Numbers
28