JAVA
JAVA
workplan
1. Introduction
2. Java Basics
3. Java Methods
4. Java Files
2
1. Introduction
- Java is a popular programming language and is used to develop
mobile apps, web apps, desktop apps, games and much more.
3
2. Java Syntax
4
Java Variables
1. String - stores text, such as "Hello"
5
Java Variables
6
Java Data types
7
Java types casting
Type casting is when you assign a value of one primitive data type to another
type.
type size
type
8
Java types casting
9
Java types casting
1. Widening Casting (automatically) - converting a smaller type to a larger
10
10
Java types casting
2. Narrowing Casting (manually) - converting a larger type to a smaller size type
11
11
Java Operators
Java divides the operators into the following groups:
1. Arithmetic operators
2. Assignment operators
3. Comparison operators
4. Logical operators
5. Bitwise operators
12
12
Java Operators
1. Arithmetic operators
13
13
Java Operators
2. Assignment operators
14
14
Java Operators
2. Assignment operators
15
15
Java Operators
3. Comparison operators
16
16
Java Operators
4. Logical operators
17
17
Java Operators
5. Bitwise operators
bits of a number
18
18
Java Operators
5. Bitwise operators
19
19
Java Operators
5. Bitwise operators - Examples
20
20
Java Operators
5. Bitwise operators - more Examples
https://www.geeksforgeeks.org/bitwise-operators-in-java/
21
21
Java Strings
22
22
Java Strings
23
23
Java Math functions
24
24
Java Math functions
25
25
Java Math functions
26
26
Java Booleans
27
27
Java Booleans
28
28
Java Conditions (If statement)
29
29
Java Conditions (If statement)
30
30
Java Conditions (If-else statement)
31
31
Java Conditions (If-else statement)
32
32
Java Conditions (If-else statement - shorthand)
33
33
Java Conditions (If-else statement - shorthand)
34
34
Java Conditions (switch statement)
35
35
Java Conditions (switch statement)
36
36
Java Loops - For
37
37
Java Loops - For
38
38
Java Loops - While
39
39
Java Loops - While
40
40
Java Loops - Do-while
41
41
Java Loops - Do-while
42
42
Java Loops - Foreach
43
43
Java Loops - Break statement
44
44
Java Loops - Continue statement
45
45
Java Arrays
46
46
Java Arrays - 1-D
47
47
Java Arrays - 1-D
48
48
Java Arrays 2-D
49
49
Java Arrays 2-D
50
50
Java ArrayList
- The difference between an array and an ArrayList in Java, is that the size
- While elements can be added and removed from an ArrayList whenever you
want
51
51
Java ArrayList - Add element
52
52
Java ArrayList - Example
53
53
Java ArrayList - Example
54
54
Java ArrayList - Example
55
55
Java ArrayList - Example
56
56
3. Java Methods
- A method is a block of code which only runs when it is called.
- Methods are used to perform certain actions, and they are also known
as functions.
57
57
3. Java Methods
58
58
3. Java Methods
59
59
3. Java Methods
60
60
3. Java Methods - Overloading
With method overloading, multiple methods can have the same name with
different parameters:
61
61
3. Java Methods - Overloading
62
62
3. Java Methods - Recursion
63
63
3. Java Methods - Recursion
64
64
3. Java Methods - Recursion
65
65
4. Java Files
- File handling is an important part of any application.
1. creating files
2. reading files
3. updating files
4. deleting files
66
66
4. Java Files - Create
67
67
4. Java Files - Write to file
68
68
4. Java Files - Read from file
69
69
4. Java Files - Delete file
70
70
5. Java Lambda Expressions
- Lambda Expressions were added in Java 8.
returns a value.
71
71
5. Java Lambda Expressions
72
72
6. Java Exceptions
When executing Java code, different errors can occur:
2. Device failure
5. Code errors
73
6. Java Exceptions
74
74