2013年9月11日星期三

Novice neighborhoods

        changeData(sb);

         System.out.println("After changeData(n), sb = " + sb);

     }

     

        public static void changeData(StringBuffer strBuf) {

            StringBuffer sb2 = new StringBuffer("Hi ");

            strBuf = sb2;

            sb2.append("World!");

     }

}

Who can help me this code under the detailed interpretation of the best from the Angle of memory and can tell me public static void changeData (StringBuffer strBuf) the specific parameters within parentheses usefulness .
------ Solution ---------------------------------------- ----

strBuf inside the function should not be re- assigned , otherwise the object passed with lost contact .
strBuf = sb2;
strBuf pointing to the local variables defined inside a function , then the operator can not change no matter how time passed object.
------ For reference only -------------------------------------- -
first, you changeData (sb); returns null type , then you call the program directly changeData (sb); what does that mean ?

You should let changeData () method returns a string, so it makes sense
------ For reference only ------------------ ---------------------

you say I probably got it in order to make this knowledge can be applied to other places I determine there trouble answer the next question : whether StringBuffer srrBuf object passed in is that ? If it is not what he is ? If he is a dummy argument or arguments ? Whether the instance variables when re- re- assignment will appear after you said that you still lose points to local variables defined within the object can not be operated while the situation ?
------ For reference only -------------------------------------- -

I feel it since the first thing you should ask questions of others to think about how to answer people's questions rather than to question the issue of right and wrong . Do not you come when the examination is also the title of a sudden can not do this right or wrong to question what topic ? For this arbitrary answer your attitude I said it could not accept it. Please be kind to others, others will treat you .
------ For reference only ---------------------------------------

I feel it Since others questions you should first think about how to answer people's questions rather than to question the issue of right and wrong . Do not you come when the examination is also the title of a sudden can not do this right or wrong to question what topic ? For this arbitrary answer your attitude I said it could not accept it. Please be kind to others, others will treat you .     

mind you this man pit ah
you ask the wrong question , but looking forward to a correct answer , but also allowed others to raise an error
------ For reference only ------------- --------------------------

I feel it since someone questions you should first go think about how to answer people's questions rather than to question the issue of right and wrong . Do not you come when the examination is also the title of a sudden can not do this right or wrong to question what topic ? For this arbitrary answer your attitude I said it could not accept it. Please be kind to others, others will treat you .               
  
mind you this man pit ah   
you ask the wrong question , but looking forward to a correct answer , but also allowed others to raise an error  
why people answered that it will not come out with something good ? Low quality is low quality
------ For reference only --------------------------------- ------
first, I did not say I must answer them very powerful . Everyone to help forum is in trouble , there are problems we mention.
Do not expose your short because of someone else you will not mind

If you do not mind others to your questions , then this forum You can not come.
------ For reference only -------------------------------------- -

you figure out who is connected to whom short not ? Looks like I got you shorting out of it ? Baffling. Like you have not read this topic casually speculate on fewer people come fraught . Moreover, such a person can come to your forum I think that individuals are able to . say you is not convinced . What are you angry exports into dirty interesting it .
------ For reference only -------------------------------------- -
individuals can come to know that you should get the picture point

没有评论:

发表评论