How does Java prevent invalid memory access?
What will be an ideal response?
Removal of pointer arithmetic is the most important language feature contributing to Java's safety. Pointer arithmetic leads to accessing inappropriate memory areas and unpredictable program behaviors that usually lead to runtime crashes. References are used instead of pointers to allow Java programmers to create data structures such as linked lists, bags, binary trees, or any other programming constructs usually created using pointers in a language such as C or C++. There is also no chance of randomly initialized variables depending on runtime memory. The Java language specification clearly defines the behaviors of uninitialized variables. All heap-based memory is initialized automatically according to the specification. An uninitialized integer always contains zero as value, and an uninitialized string always contains spaces. The javac compiler does not allow any class or instance variable to be set to undefined values. In addition, all local variables must be assigned; otherwise, the javac compiler produces an error and stops the compilation process.
You might also like to view...
An ActionEvent must be handled by an object called an ActionListener.
Answer the following statement true (T) or false (F)
Partitioning a drive can potentially ________ fragmentation.
a) increase b) decrease c) eliminate d) None of the above. Partitioning has no effect on fragmentation
Custom headers and footers provide ________ sections where you can type your own text or insert header and footer elements
A) one B) four C) two D) three
The ________ refers to the first 10 amendments to the Constitution and protects the rights of the individual
a. Bill of Rights b. Declaration of Independence c. Search and Seizure Laws d. None of the above