Java Assignment
Java Assignment
# [Video Link](https://youtu.be/TAtrPoaJ7gc)
2. Take name as input and print a greeting message for that particular
name.
3. Write a program to input principal, time, and rate (P, T, R) from the
user and find Simple Interest.
(Use if conditions)
03-CONDITIONAL LOOPS
# [Video Link](https://youtu.be/ldYLYRNaucM)
## Write Java programs for the following:
1. Area Of Circle
2. Area Of Triangle
3. Area Of Rectangle
5. Area Of Parallelogram
6. Area Of Rhombus
8. Perimeter Of Circle
(https://leetcode.com/problems/subtract-the-product-and-sum-of-
digits-of-an-integer/)
23. Input a number and print all the factors of that number (use loops).
24. Take integer inputs till the user enters 0 and print the sum of all
numbers (HINT: while loop)
25. Take integer inputs till the user enters 0 and print the largest
number from all.
04-FUNCTIONS
# [Video Link](https://youtu.be/vvanI8NRlSI)
(https://www.java67.com/2019/05/how-to-find-largest-and-smallest-
of-three-numbers-in-java.html)
(https://www.geeksforgeeks.org/java-program-to-check-if-a-given-
integer-is-odd-or-even/)
(https://www.efaculty.in/java-programs/voting-age-program-in-java/)
4. [Write a program to print the sum of two numbers entered by user
by defining your own method.](https://code4coding.com/addition-of-
two-numbers-in-java-using-method/)
(https://code4coding.com/java-program-to-multiply-two-numbers-
using-method/)
(https://beginnersbook.com/2014/01/java-program-to-calculate-area-
and-circumference-of-circle/)
(https://www.geeksforgeeks.org/java-program-to-check-if-a-number-
is-prime-or-not/)
8. [Write a program that will ask the user to enter his/her marks (out of
100). Define a method that will display grades according to the marks
entered as below:]
(https://www.techcrashcourse.com/2017/02/java-program-to-
calculate-grade-of-students.html)
<br/>
<pre>
Marks Grade
91-100 AA
81-90 AB
71-80 BB
61-70 BC
51-60 CD
41-50 DD
<=40 Fail
</pre>
(https://www.javatpoint.com/factorial-program-in-java)
<pre>
4! = 1 * 2 * 3 * 4 = 24
3! = 3 * 2 * 1 = 6
2! = 2 * 1 = 2
Also,
1! = 1
0! = 1
</pre>
10. [Write a function to find if a number is a palindrome or not. Take
number as parameter.]
(https://www.geeksforgeeks.org/check-if-a-number-is-palindrome/)
(https://www.geeksforgeeks.org/find-pythagorean-triplet-in-an-
unsorted-array/)
13. [Write a function that returns all prime numbers between two given
numbers.]
(https://www.geeksforgeeks.org/program-to-find-prime-numbers-
between-given-interval/)
14. [Write a function that returns the sum of first n natural numbers.]
(https://www.geeksforgeeks.org/program-find-sum-first-n-natural-
numbers/)
05-ARRAY
# [Video Link](https://youtu.be/n60Dn0UsbEk)
(https://leetcode.com/problems/build-array-from-permutation/)
2. [Concatenation of Array]
(https://leetcode.com/problems/concatenation-of-array/)
(https://leetcode.com/problems/running-sum-of-1d-array/)
(https://leetcode.com/problems/richest-customer-wealth/)
(https://leetcode.com/problems/shuffle-the-array/)
(https://leetcode.com/problems/kids-with-the-greatest-number-of-
candies/)
(https://leetcode.com/problems/number-of-good-pairs/)
(https://leetcode.com/problems/how-many-numbers-are-smaller-than-
the-current-number/)
9. [Create Target Array in the Given Order]
(https://leetcode.com/problems/create-target-array-in-the-given-
order/)
(https://leetcode.com/problems/check-if-the-sentence-is-pangram/)
(https://leetcode.com/problems/count-items-matching-a-rule/)
(https://leetcode.com/problems/find-the-highest-altitude/)
(https://leetcode.com/problems/flipping-an-image/)
(https://leetcode.com/problems/cells-with-odd-values-in-a-matrix/)
(https://leetcode.com/problems/matrix-diagonal-sum/)
(https://leetcode.com/problems/find-numbers-with-even-number-of-
digits/)
(https://leetcode.com/problems/transpose-matrix/)
18. [Add to Array-Form of Integer]
(https://leetcode.com/problems/add-to-array-form-of-integer/)
(https://leetcode.com/problems/maximum-population-year/)
(https://leetcode.com/problems/determine-whether-matrix-can-be-
obtained-by-rotation/)
(https://leetcode.com/problems/two-sum/)
(https://leetcode.com/problems/find-n-unique-integers-sum-up-to-
zero/)
(https://leetcode.com/problems/lucky-numbers-in-a-matrix/)
(https://leetcode.com/problems/maximum-subarray/)
(https://leetcode.com/problems/reshape-the-matrix/)
(https://leetcode.com/problems/plus-one/)
27. [Remove Duplicates from Sorted Array]
(https://leetcode.com/problems/remove-duplicates-from-sorted-
array/)
(https://leetcode.com/problems/minimum-cost-to-move-
chips-to-the-same-position/)
### Medium
1. [Spiral Matrix]
(https://leetcode.com/problems/spiral-matrix/)
(https://leetcode.com/problems/spiral-matrix-ii/)
(https://leetcode.com/problems/spiral-matrix-iii/)
(https://leetcode.com/problems/set-matrix-zeroes/)
(https://leetcode.com/problems/product-of-array-except-self/)
7. [Jump Game]
(https://leetcode.com/problems/jump-game/)
8. [Rotate Array]
(https://leetcode.com/problems/rotate-array/)
9. [Sort Colors]
(https://leetcode.com/problems/sort-colors/)
(https://leetcode.com/problems/house-robber/)
### Hard
(https://leetcode.com/problems/max-value-of-equation/)
(https://leetcode.com/problems/first-missing-positive/)
3. [Good Array]
(https://leetcode.com/problems/check-if-it-is-a-good-array/)
14-OBJECT ORIENTED PROGRAMMING
# Important Topics-
[Kunal's notes]
(https://github.com/kunal-kushwaha/DSA-Bootcamp-
Java/tree/main/lectures/17-oop/notes) –
(https://www.geeksforgeeks.org/object-oriented-programming-oops-
concept-in-java/) `GFG`-
[Constructors in Java]
(https://www.geeksforgeeks.org/constructors-in-java/) `GFG-
[Constructor chaining in Java]
(https://www.geeksforgeeks.org/constructor-chaining-java-examples/)
`GFG`-
[Inheritance in Java]
(https://www.geeksforgeeks.org/inheritance-in-java/) `GFG`-
[Overriding in Java]
(https://www.geeksforgeeks.org/overriding-in-java/) `GFG -
[Abstraction in Java]
(https://www.geeksforgeeks.org/abstraction-in-java-2/) `GFG`-
(https://www.geeksforgeeks.org/access-modifiers-java/) `GFG`-
[Wrapper Classes in Java]
(https://www.geeksforgeeks.org/wrapper-classes-java/) `GFG`-
(https://www.geeksforgeeks.org/need-of-wrapper-classes-in-java/)
`GFG`
(https://www.javatpoint.com/this-keyword) `Javatpoint`
(https://www.tutorialspoint.com/java/java_inheritance.htm)
`Tutorialspoint`
(https://www.javatpoint.com/instance-initializer-block) `Javatpoint`
(https://www.geeksforgeeks.org/dynamic-method-dispatch-runtime-
polymorphism-java/) `GFG`
- [Cohesion in Java
](https://www.geeksforgeeks.org/cohesion-in-java/) `GFG`
- [Coupling in Java]
(https://www.geeksforgeeks.org/coupling-in-java/) `GFG`
# Interview Questions
- [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)
`Tutorialspoint`
(https://www.geeksforgeeks.org/difference-between-method-
overloading-and-method-overriding-in-java/) `GFG`
(https://www.tutorialspoint.com/can-we-declare-interface-members-
as-private-or-protected-in-java8) `Tutorialspoint`
(https://www.tutorialspoint.com/can-we-override-a-private-or-static-
method-in-java) `Tutorialspoint`
(https://www.javatpoint.com/what-is-diamond-problem-in-java)
`Javatpoint`
(https://www.javatpoint.com/this-
keyword#:~:text=this%3A%20to%20pass%20as%20an%20argument%2
0in%20the%20method) `Javatpoint`
(https://www.javatpoint.com/covariant-return-type) `Javatpoint`
(https://www.geeksforgeeks.org/private-constructors-and-singleton-
classes-in-java/) `GFG`
(https://www.geeksforgeeks.org/prevent-singleton-pattern-reflection-
serialization-cloning/) `GFG`
(https://www.geeksforgeeks.org/java-program-to-demonstrate-the-
double-check-locking-for-singleton-class/) `GFG`
# Practice Problems
- [Inheritance I]
(https://www.hackerrank.com/challenges/java-inheritance-
1/problem?isFullScreen=true) `HackerRank`-
[Inheritance II]
(https://www.hackerrank.com/challenges/java-inheritance-
2/problem?isFullScreen=true) `HackerRank`-
[Java Abstract class]
(https://www.hackerrank.com/challenges/java-abstract-
class/problem?isFullScreen=true) `HackerRank`
- [Interface]
(https://www.hackerrank.com/challenges/java-
interface/problem?isFullScreen=true) `HackerRank`-
[Method Overriding I]
(https://www.hackerrank.com/challenges/java-method-
overriding/problem?isFullScreen=true) `HackerRank`-
(https://www.hackerrank.com/challenges/java-method-overriding-2-
super-keyword/problem?isFullScreen=true) `HackerRank`-
(https://www.hackerrank.com/challenges/java-instanceof-
keyword/problem?isFullScreen=true) `HackerRank`-
[Java Iterator]
(https://www.hackerrank.com/challenges/java-
iterator/problem?isFullScreen=true) `HackerRank`