Friday, 29 January 2021

Method overriding rule important

 1. return type can be different  ,  if they return a subtype like parent class return type Number and child class Integer.

2.Another worth noting rule of method overriding in Java is that the overriding  method can not throw checked Exception which is higher in the hierarchy than the overridden method. This means if the overridden method throws IOException than the overriding method can not throw java.lang.Exception in its throws clause because of java.lang.Exception comes higher than IOException in Exception hierarchy. 

3. You can not override private, static and final the method in Java. private and static method are bonded during compile time using static binding in Java and doesn't resolve during runtime. the overriding the final method in Java is a compile-time error. Though private and static methods can be hidden if you declare another method with the same and signature in the subclass.

4.to override a method in Java is that the overriding method can not reduce the accessibility of the overridden method in Java. For example, if the overridden method is public than the overriding method can not be protected, private or package-private

Thursday, 21 January 2021

How to set default java version

 sudo update-java-alternatives --list

to list off all the Java installations on a machine by name and directory, and then run

sudo  update-java-alternatives --set [JDK/JRE name e.g. java-8-oracle]

Thursday, 14 January 2021

How does SSL really work?

Ref: https://stackoverflow.com/questions/470523/how-does-ssl-really-work

HTTPS is combination of HTTP and SSL(Secure Socket Layer) to provide encrypted communication between client (browser) and web server (application is hosted here).


Why is it needed?


HTTPS encrypts data that is transmitted from browser to server over the network. So, no one can sniff the data during transmission.


How HTTPS connection is established between browser and web server?


Browser tries to connect to the https://payment.com.

payment.com server sends a certificate to the browser. This certificate includes payment.com server's public key, and some evidence that this public key actually belongs to payment.com.

Browser verifies the certificate to confirm that it has the proper public key for payment.com.

Browser chooses a random new symmetric key K to use for its connection to payment.com server. It encrypts K under payment.com public key.

payment.com decrypts K using its private key. Now both browser and the payment server know K, but no one else does.

Anytime browser wants to send something to payment.com, it encrypts it under K; the payment.com server decrypts it upon receipt. Anytime the payment.com server wants to send something to your browser, it encrypts it under K. 




links for Data Structure

  1) 𝐁𝐞𝐜𝐨𝐦𝐞 𝐌𝐚𝐬𝐭𝐞𝐫 𝐢𝐧 𝐋𝐢𝐧𝐤𝐞𝐝 𝐋𝐢𝐬𝐭:  https://lnkd.in/gXQux4zj 2) 𝐀𝐥𝐥 𝐭𝐲𝐩𝐞𝐬 𝐨𝐟 𝐓𝐫𝐞𝐞 𝐓𝐫𝐚𝐯𝐞𝐫𝐬𝐚𝐥𝐬...