Interesting point/question Shivanyy.
First, let me point out that I could very well be wrong with my reply/this post or some parts of it at least.
Let's all get on the same page, shall we:
S ingle Responsibility Principle
a class should have only a single responsibility (i.e. changes to only one part of the software's specification should be able to affect the specification of the class).
O pen/closed
"software entities … should be open for extension, but closed for modification."
L iskov substitution
"objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program."
I nterface segregation
"many client-specific interfaces are better than one general-purpose interface."
D ependency inversion
one should "depend upon abstractions, [not] concretions."
A.K.A.
SOLID, you can read more about this here
https://www.composablesystems.com/solid-principles-make-code-flexible/ and
Wikipedia.
For Single Responsibility Principle, I think that we can look at the file class
https://docs.oracle.com/javase/9/docs/api/java/io/File.html
This class is only responsible for files and nothing else.
For Open/closed, perhaps the use of the Map interface is a good example
https://docs.oracle.com/javase/9/docs/api/java/util/Map.html
All the classes that use that interface could be swapped out for a different class that use that interface.
You cannot change base interface, but you can add to it the classes that use it if you choose to
For Liskov substitution, the List interface comes to mind
https://docs.oracle.com/javase/9/docs/api/java/util/List.html
If you program against a List interface then you should be able use a LinkedList, ArrayList etc with very little modification of your code it any.
Interface segregation, how about Comparable
https://docs.oracle.com/javase/9/docs/api/java/lang/Comparable.html
How Class A implements Comparable can be totally different then how Class B implements Comparable.
Dependency inversion, how about List, or Maps?
Both are abstracts, where ArrayList or HashMap are programmed against those.
On a related note, when you install Java you are usually given the option to install the source code at the same time.
You can also find the source code here
http://openjdk.java.net/ if you choose to.
Plus, Oracle provide documentation of the Java APIs online for free as noted/found here
https://docs.oracle.com/javase/9/docs/api/overview-summary.html