Sunday, May 23, 2021

Java: String is final & immutable because

String is final & immutable because...

  • String pool stores only one copy hence memory is saved
  • Security: username & password like sensitive info received from external sources cannot modified in implementation (i.e. after/before validation
  • Helps in Caching & Hashing i.e. hash value of the String is cached and returned (as it never changes)
  • Above #1, #2 & #3, helps in improving the performance
  • As strings are immutable, they are thread safe hence helps in synchronization

No comments:

SpringBoot: Features: SpringApplication

Below are a few SpringBoot features corresponding to SpringApplication StartUp Logging ·          To add additional logging during startup...