Declare an object inside or outside a loop?

前端 未结 16 841
广开言路
广开言路 2020-12-07 17:15

Is there any performance penalty for the following code snippet?

for (int i=0; i         


        
16条回答
  •  不知归路
    2020-12-07 18:16

    When using multiple threads (if your doing 50+) then i found this to be a very effective way of handling ghost thread problems:

    Object one;
    Object two;
    Object three;
    Object four;
    Object five;
    try{
    for (int i=0; i

提交回复
热议问题