-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
23 lines (19 loc) · 1.16 KB
/
Main.java
File metadata and controls
23 lines (19 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
public class Main {
public static void main(String[] args) {
System.out.println("Hello, My name is Rono Beatrice Chepchirchir.");
}
}
// NOTE: Every line of code that runs in Java must be in a class.
// In Java, we use fields to store data, while we use methods to perform operations.
// Note that a class should always start with an uppercase first letter, and the Java file should match the class name.
//An object is an entity in the real world that can be distinctly identified. Objects have states and behaviors. In other words, they consist of methods and properties to make a particular type of data useful.
// An object consists of:
// A unique identity: Each object has a unique identity, even if the state is identical to that of another object.
// State/Properties/Attributes: State tells us how the object looks or what properties it has.
// Behavior: Behavior tells us what the object does.
// Examples of object states and behaviors in Java:
// Let's look at some real-life examples of the states and behaviors that objects can have.
// Example 1:
// Object: car.
// State: color, brand, weight, model.
// Behavior: break, accelerate, turn, change gears.