Some notes in Stanford CS106A(3)

1.If ( str1==str2 ) 

means if str1 and str2 are refers to the same OBJECT.

But when compare string , they are not the same actual object.

So we usually use "str1.equals(str2)" to compare the value of the two strings.

2.encryption  Caesar Cipher

3.RAM----random access memory * everything have an adress 

1 ) Static variables/Const  ( in a special location ) --in the memories to visit at the beginning of program

2 ) Dynamic variables ( use "new" on ) -- the memory that comes for a dynamic called the HEAP.  HEAP goes from the top and goes down.

Garbage collection : It's memory from the heap just gets reclaimed when it's no longer being used. But Ala you're using it , this memory still set aside for you.

3 ) Local variables ( Stack ) -- method or parameters ( that got copied of the values which means it has to live sw in memory ) . Stack from the deep and goes up.

When those variables go out of scope , like the method actually end, or get some closing curly brace, the Stack will AUTO get the memories:

----when variables is no longer use , it will popped off from the stack -- remove from the top. ( automaticlly get de-allocated by the machine. )

4 ) Stack piont to a location in heap.

4. Exception (略)

原文地址:https://www.cnblogs.com/wleaves/p/10506245.html