Is passing 'this' in a method call accepted practice in java

后端 未结 10 1152
无人共我
无人共我 2021-01-30 19:32

Is it good/bad/acceptable practice to pass the current object in a method call. As in:

public class Bar{
    public Bar(){}

    public void foo(Baz baz){
              


        
10条回答
  •  时光说笑
    2021-01-30 19:43

    Yes. you can use it.Its just common in programming to pass this.But there are pros and cons about using that.Still it is not hazardous to do so.

提交回复
热议问题