Random Notes#
1. In Java object-oriented design, when to use abstract classes? When to use interfaces?#
Generally, design nouns as abstract classes
For example: animals, cars, fruits
Design verbs, functions as interfaces
For example: DAO, service, controller
2. What do memory overflow and memory leak refer to?#
Memory overflow refers to the memory being unable to accommodate the data being written. For example, if the memory is only 100MB and there is a need to write 200MB of data into it, a memory overflow issue will occur.
Memory leak refers to the existence of unreleased memory in the memory, causing the unreleased memory to occupy memory for a long time. For example, if there is 100MB of memory and 80MB of content is written into it, even though the memory is sufficient, an error may occur, indicating a memory leak.
Possible reasons include: 1. Failure to release previously used memory (can be manually destructed to avoid this issue) 2. Memory fragmentation (memory fragmentation issue cannot be solved, only minimized by using a memory manager)
--------------------------------------To be continued-----------------------------------