Skip to content

Commit 2ae8fae

Browse files
authored
Update README.md
1 parent eb31a30 commit 2ae8fae

File tree

1 file changed

+45
-0
lines changed
  • OOPS_Object_oriented_Concepts/A01_Linkedin_learning

1 file changed

+45
-0
lines changed

OOPS_Object_oriented_Concepts/A01_Linkedin_learning/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,48 @@
5151
<img width="1920" height="1080" alt="Screenshot (192)" src="https://github.com/user-attachments/assets/dc73da74-d375-4a8e-91d9-a3d1469275b8" />
5252
<img width="1920" height="1080" alt="Screenshot (193)" src="https://github.com/user-attachments/assets/b809a675-0130-421d-82d6-4c2c11bcaa3a" />
5353
<img width="1920" height="1080" alt="Screenshot (194)" src="https://github.com/user-attachments/assets/95634fae-6682-48a2-b302-0903e1886f58" />
54+
55+
---
56+
57+
## play with String
58+
59+
<img width="1920" height="1080" alt="Screenshot (197)" src="https://github.com/user-attachments/assets/3af4564c-e910-456b-843d-cca9c7b00260" />
60+
61+
## Chalange 01
62+
63+
<img width="1920" height="1080" alt="Screenshot (198)" src="https://github.com/user-attachments/assets/c730c272-f9c6-431b-9cf8-d6160a5a117a" />
64+
<img width="1920" height="1080" alt="Screenshot (199)" src="https://github.com/user-attachments/assets/a0004827-51bf-487b-a225-d90d4a0cfd03" />
65+
66+
| [files](https://github.com/akashdip2001/Java/tree/main/OOPS_Object_oriented_Concepts/A01_Linkedin_learning/Ex_Files_Learning_Java/Exercise%20Files/Chapter%2002/02_10/end/src) |
67+
| --- |
68+
69+
```java
70+
public class Dog {
71+
72+
String name;
73+
int age;
74+
String[] fetchedItems = {"bone", "stick", "ball"};
75+
private int fetchCounter = 0;
76+
77+
public Dog(String name, int age) {
78+
this.name = name;
79+
this.age = age;
80+
}
81+
82+
public void bark() {
83+
System.out.println("Bark!");
84+
}
85+
86+
public int getDogYears() {
87+
// Assume 1 dog year is 7 human years
88+
return this.age * 7;
89+
}
90+
91+
public void fetch() {
92+
this.fetchCounter = (this.fetchCounter + 1) % 3;
93+
String item = this.fetchedItems[this.fetchCounter];
94+
System.out.println(name + " fetched a " + item + ".");
95+
}
96+
97+
}
98+
```

0 commit comments

Comments
 (0)