## Stack Memory Vs Heap Memory
- Stack memory is memory allocated to a program, in fixed amounts
- Variables and methods are stored in stack memory
- Heap memory is for objects
## Differences between Java and C++
- C++ is a compiled language; Java can be compiled and can be interpreted
- Java is machine-independent; C++ can only be run on the machine it was compiled
- C++ lets the programmer use pointers but Java does not; Java uses pointers internally
- C++ supports multiple inheritance; Java does not and doesn't know how to handle the [[Diamond Problem]]
## Just-In Time Compiler
- Improves performance at runtime
- Compiles similar byte code at the same time to reduce compilation time
## Difference between .equals() and ==
`==` only works for primitive data types and has a caveat for Strings. The caveat is that `==` only works if both Strings are created as literals, aka `String str1 = "my string";`. If one or both are creating using the object constructor, then those Strings are created in a separate memory pool.
`.equals()` works for objects, and only compares if their values are the same. It does not compare and see if they point to the same object in memory.