4 Replies Latest reply on Mar 8, 2009 12:30 AM by 796440

    Is the instance fields have private accessibility in String class?

      Is the instance fields have private accessibility in an immutable class, such as the String class?

      also Could any one answer the following question,

      (This is the question I got in written exam for job recruitment)

      "Invoking a method can represent a significant amount of overhead in a program; as such, some compilers will perform an optimization called "method inlining." This optimization will remove a method call by copying the code inside the method into the calling method."

      Referring to the text above, which one of these statements is true?

      Choice 1 The performance benefits should be balanced against the increased chance of a RuntimeException.

      Choice 2 It allows the use of getter and setter methods to execute nearly as fast as direct access to member variables.

      Choice 3 This optimization will only occur if the relevant methods are declared volatile.

      Choice 4 The developer of inlined methods must copy and paste the code that is to be inlined into another method.

      Choice 5 It prevents code from executing in a way that follows object-oriented encapsulation.