我看过一些论坛帖子,我知道java是Pass by Value。不过我对此仍然有点困惑。所以我的问题是,如果StoryFragment有一个注释数组,我想通过另一个具有addAnnotation方法的类在该数组中添加一个注释,那么我的代码将在下面工作吗?在StoryFragment中,我使用getter方法来接收注释数组。
public class StoryFragmentController {
public void addAnnotation(Annotation annotation, StoryFragment storyFragment){
storyFragment.getAnnotations().add(annotation);
}
提前致谢。