I have a method and inside this method I have a block:
public void method()
{
[block instructions]
}
But this method is called twice in
You should probably redesign your method. It's confusing for someone trying to understand your program if a method does something different the second time it's run.
Is it called from a different place in your program, the second time? If that's the case, the easiest thing to do is to extract the bit that's duplicated into another method.
method() {
// Do stuff that's run only the first time
method2()
}
method2() {
// Do stuff that's run both times
}
If it's called from the SAME place, you should ask yourself why your code is expecting something different to happen the second time.