Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/merttalug/truck_owner
A java program that creates a person class named Person, assigns the information from that class to the Vehicle class as a parameter named owner, and inherits the Truck class from the Vehicle class. It is aimed to learn the basics of object-oriented programming and the concept of inheritance.
https://github.com/merttalug/truck_owner
classes inheritance java javase netbeans-project object-oriented-programming oop oop-in-java oop-principles
Last synced: 19 days ago
JSON representation
A java program that creates a person class named Person, assigns the information from that class to the Vehicle class as a parameter named owner, and inherits the Truck class from the Vehicle class. It is aimed to learn the basics of object-oriented programming and the concept of inheritance.
- Host: GitHub
- URL: https://github.com/merttalug/truck_owner
- Owner: merttalug
- License: mit
- Created: 2022-04-18T23:00:28.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-04-18T23:21:03.000Z (almost 3 years ago)
- Last Synced: 2024-11-22T06:28:41.709Z (3 months ago)
- Topics: classes, inheritance, java, javase, netbeans-project, object-oriented-programming, oop, oop-in-java, oop-principles
- Language: Java
- Homepage:
- Size: 20.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Truck_Owner
A java program that creates a person class named Person, assigns the information from that class to the Vehicle class as a parameter named owner, and inherits the Truck class from the Vehicle class. It is aimed to learn the basics of object-oriented programming and the concept of inheritance.## Purpose of Objects
We have assigned the following properties and behaviors to an object named truck, created from the Truck class, which we inherited from the Vehicle class:
* **Marka** : MAN
* **Owner** : Person Class(Mert)
* **Silindir** : 5
* **Capacity** : 7500.5## Equals Method (for String Classes)
Then we created another object named truck_2 of the same class, compared it with the truck object using the equals method and returned a boolean value. The boolean value we expect should be false, as it must occupy different places in memory.
```
Person person = new Person("Mert");
Truck truck = new Truck ("MAN",5,person,7500.5);
System.out.println(truck);
Truck truck2 = new Truck (truck);
System.out.println(truck2.equals(truck));
```### Output
```
Marka: MAN
Silindir: 5
Name: Mert
Capacity: 7500.5
false
```