Skip to content

Commit 5342434

Browse files
committed
OOP 1 | Introduction & Concepts - Classes, Objects, Constructors, Keywords :check
1 parent 6e0fd39 commit 5342434

File tree

4 files changed

+365
-29
lines changed

4 files changed

+365
-29
lines changed

A03__conditionals_loops/assignments/Basic/Program_22.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

A09__patterns/assignments/README.md

Lines changed: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
# Pattern Questions
2+
3+
Print these patterns using loops:
4+
5+
```text
6+
7+
1. *****
8+
*****
9+
*****
10+
*****
11+
*****
12+
13+
14+
2. *
15+
**
16+
***
17+
****
18+
*****
19+
20+
21+
3. *****
22+
****
23+
***
24+
**
25+
*
26+
27+
28+
4. 1
29+
1 2
30+
1 2 3
31+
1 2 3 4
32+
1 2 3 4 5
33+
34+
35+
5. *
36+
**
37+
***
38+
****
39+
*****
40+
****
41+
***
42+
**
43+
*
44+
45+
46+
6. *
47+
**
48+
***
49+
****
50+
*****
51+
52+
53+
7. *****
54+
****
55+
***
56+
**
57+
*
58+
59+
60+
8. *
61+
***
62+
*****
63+
*******
64+
*********
65+
66+
67+
9. *********
68+
*******
69+
*****
70+
***
71+
*
72+
73+
74+
10. *
75+
* *
76+
* * *
77+
* * * *
78+
* * * * *
79+
80+
81+
11. * * * * *
82+
* * * *
83+
* * *
84+
* *
85+
*
86+
87+
88+
12. * * * * *
89+
* * * *
90+
* * *
91+
* *
92+
*
93+
*
94+
* *
95+
* * *
96+
* * * *
97+
* * * * *
98+
99+
100+
13. *
101+
* *
102+
* *
103+
* *
104+
*********
105+
106+
107+
14. *********
108+
* *
109+
* *
110+
* *
111+
*
112+
113+
114+
15. *
115+
* *
116+
* *
117+
* *
118+
* *
119+
* *
120+
* *
121+
* *
122+
*
123+
124+
125+
16. 1
126+
1 1
127+
1 2 1
128+
1 3 3 1
129+
1 4 6 4 1
130+
131+
132+
17. 1
133+
212
134+
32123
135+
4321234
136+
32123
137+
212
138+
1
139+
140+
141+
18. **********
142+
**** ****
143+
*** ***
144+
** **
145+
* *
146+
* *
147+
** **
148+
*** ***
149+
**** ****
150+
**********
151+
152+
153+
19. * *
154+
** **
155+
*** ***
156+
**** ****
157+
**********
158+
**** ****
159+
*** ***
160+
** **
161+
* *
162+
163+
164+
20. ****
165+
* *
166+
* *
167+
* *
168+
****
169+
170+
21. 1
171+
2 3
172+
4 5 6
173+
7 8 9 10
174+
11 12 13 14 15
175+
176+
22. 1
177+
0 1
178+
1 0 1
179+
0 1 0 1
180+
1 0 1 0 1
181+
182+
23. * *
183+
* * * *
184+
* * *
185+
186+
24. * *
187+
** **
188+
* * * *
189+
* * * *
190+
* ** *
191+
* ** *
192+
* * * *
193+
* * * *
194+
** **
195+
* *
196+
197+
25. *****
198+
* *
199+
* *
200+
* *
201+
*****
202+
203+
26. 1 1 1 1 1 1
204+
2 2 2 2 2
205+
3 3 3 3
206+
4 4 4
207+
5 5
208+
6
209+
210+
27. 1 2 3 4 17 18 19 20
211+
5 6 7 14 15 16
212+
8 9 12 13
213+
10 11
214+
215+
28. *
216+
* *
217+
* * *
218+
* * * *
219+
* * * * *
220+
* * * *
221+
* * *
222+
* *
223+
*
224+
225+
29.
226+
* *
227+
** **
228+
*** ***
229+
**** ****
230+
**********
231+
**** ****
232+
*** ***
233+
** **
234+
* *
235+
236+
30. 1
237+
2 1 2
238+
3 2 1 2 3
239+
4 3 2 1 2 3 4
240+
5 4 3 2 1 2 3 4 5
241+
242+
243+
31. 4 4 4 4 4 4 4
244+
4 3 3 3 3 3 4
245+
4 3 2 2 2 3 4
246+
4 3 2 1 2 3 4
247+
4 3 2 2 2 3 4
248+
4 3 3 3 3 3 4
249+
4 4 4 4 4 4 4
250+
251+
32. E
252+
D E
253+
C D E
254+
B C D E
255+
A B C D E
256+
257+
33. a
258+
B c
259+
D e F
260+
g H i J
261+
k L m N o
262+
263+
34. E D C B A
264+
D C B A
265+
C B A
266+
B A
267+
A
268+
269+
35. 1 1
270+
12 21
271+
123 321
272+
12344321
273+
```

A14__oops/assignments/README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Important Topics
2+
3+
- [Kunal's notes](https://github.com/kunal-kushwaha/DSA-Bootcamp-Java/tree/main/lectures/17-oop/notes)
4+
- [Object Oriented Paradigms](https://www.geeksforgeeks.org/object-oriented-programming-oops-concept-in-java/) `GFG`
5+
- [Constructors in Java](https://www.geeksforgeeks.org/constructors-in-java/) `GFG`
6+
- [Constructor chaining in Java](https://www.geeksforgeeks.org/constructor-chaining-java-examples/) `GFG`
7+
- [Inheritance in Java](https://www.geeksforgeeks.org/inheritance-in-java/) `GFG`
8+
- [Overriding in Java](https://www.geeksforgeeks.org/overriding-in-java/) `GFG`
9+
- [Abstraction in Java](https://www.geeksforgeeks.org/abstraction-in-java-2/) `GFG`
10+
- [Access modifiers in Java](https://www.geeksforgeeks.org/access-modifiers-java/) `GFG`
11+
- [Wrapper Classes in Java](https://www.geeksforgeeks.org/wrapper-classes-java/) `GFG`
12+
- [Need of wrapper classes in Java](https://www.geeksforgeeks.org/need-of-wrapper-classes-in-java/) `GFG`
13+
- [this keyowrd in Java](https://www.javatpoint.com/this-keyword) `Javatpoint`
14+
- [Important keyowrds in Java inheritance - extends,implements,super,instanceof](https://www.tutorialspoint.com/java/java_inheritance.htm)
15+
`Tutorialspoint`
16+
- [Instance initializer block](https://www.javatpoint.com/instance-initializer-block) `Javatpoint`
17+
- [Dynamic Method Dispatch or Runtime Polymorphism in Java](https://www.geeksforgeeks.org/dynamic-method-dispatch-runtime-polymorphism-java/)
18+
`GFG`
19+
- [Cohesion in Java](https://www.geeksforgeeks.org/cohesion-in-java/) `GFG`
20+
- [Coupling in Java](https://www.geeksforgeeks.org/coupling-in-java/) `GFG`
21+
22+
# Interview Questions
23+
24+
- [Can we declare main() method as private or protected or with no access modifier in java?](https://www.tutorialspoint.com/can-we-declare-main-method-as-private-or-protected-or-with-no-access-modifier-in-java)
25+
`Tutorialspoint`
26+
- [Difference between Method Overloading and Method Overriding in Java?](https://www.geeksforgeeks.org/difference-between-method-overloading-and-method-overriding-in-java/)
27+
`GFG`
28+
- [Can we declare interface members as private or protected in java8?](https://www.tutorialspoint.com/can-we-declare-interface-members-as-private-or-protected-in-java8)
29+
`Tutorialspoint`
30+
- [Can we override a private or static method in Java?](https://www.tutorialspoint.com/can-we-override-a-private-or-static-method-in-java)
31+
`Tutorialspoint`
32+
- [What is diamond problem in Java?](https://www.javatpoint.com/what-is-diamond-problem-in-java) `Javatpoint`
33+
- [Can we pass this keyword as argument in a method call?](https://www.javatpoint.com/this-keyword#:~:text=this%3A%20to%20pass%20as%20an%20argument%20in%20the%20method)
34+
`Javatpoint`
35+
- [Java constructor returns a value, but what?](https://www.javatpoint.com/java-constructor-returns-a-value-but-what)
36+
`Javatpoint`
37+
- [What is covariant return type?](https://www.javatpoint.com/covariant-return-type) `Javatpoint`
38+
- [Private classes and singleton classes in Java](https://www.geeksforgeeks.org/private-constructors-and-singleton-classes-in-java/)
39+
`GFG`
40+
- [How to prevent Singleton Pattern from Reflection, Serialization and Cloning?](https://www.geeksforgeeks.org/prevent-singleton-pattern-reflection-serialization-cloning/)
41+
`GFG`
42+
- [Double-Check Locking For Singleton Class](https://www.geeksforgeeks.org/java-program-to-demonstrate-the-double-check-locking-for-singleton-class/)
43+
`GFG`
44+
45+
# Practice Problems
46+
47+
- [Inheritance I](https://www.hackerrank.com/challenges/java-inheritance-1/problem?isFullScreen=true) `HackerRank`
48+
- [Inheritance II](https://www.hackerrank.com/challenges/java-inheritance-2/problem?isFullScreen=true) `HackerRank`
49+
- [Java Abstract class](https://www.hackerrank.com/challenges/java-abstract-class/problem?isFullScreen=true)
50+
`HackerRank`
51+
- [Interface](https://www.hackerrank.com/challenges/java-interface/problem?isFullScreen=true) `HackerRank`
52+
- [Method Overriding I](https://www.hackerrank.com/challenges/java-method-overriding/problem?isFullScreen=true)
53+
`HackerRank`
54+
- [Method Overriding II (Use super keyword)](https://www.hackerrank.com/challenges/java-method-overriding-2-super-keyword/problem?isFullScreen=true)
55+
`HackerRank`
56+
- [Java instanceof keyword](https://www.hackerrank.com/challenges/java-instanceof-keyword/problem?isFullScreen=true)
57+
`HackerRank`
58+
- [Java Iterator](https://www.hackerrank.com/challenges/java-iterator/problem?isFullScreen=true) `HackerRank`

A14__oops/src/introduction/Main.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package A14__oops.src.introduction;
2+
3+
public class Main {
4+
public static void main(String[] args) {
5+
// store 5 roll nos
6+
int[] numbers = new int[5];
7+
8+
// store 5 names
9+
String[] names = new String[5];
10+
11+
// data of 5 students: {roll no, name, marks}
12+
String[] name = new String[5];
13+
int[] rno = new int[5];
14+
float[] marks = new float[5];
15+
16+
// instantiating an object out of a class
17+
Student ranit = new Student();
18+
ranit.name = "Ranit Manik";
19+
ranit.rno = 34;
20+
ranit.mark = 40;
21+
22+
System.out.println(ranit.name);
23+
System.out.println(ranit.rno);
24+
System.out.println(ranit.mark);
25+
}
26+
}
27+
28+
// creating a class
29+
// classes => datatypes
30+
class Student {
31+
String name;
32+
int rno;
33+
float mark;
34+
}

0 commit comments

Comments
 (0)