I have a method which changes a texture to another random one.
public void Texturechange(Texture texture){
        String imagename;
        randomImage = random.nextInt(90)+1;
         if ( randomImage <10){
                imagename="00"+ randomImage +".jpg";
            } else if(randomImage >9) {
                imagename="0"+ randomImage +".jpg";
            }
         Texture newTexture = new Texture(imagename);
         texture = newTexture;
    }
After printing the results I see texture changed to newTexture but it does not update on screen.However the following code does update on screen can anyone tell me why?
public void Texturechange(Texture texture){
            String imagename;
            randomImage = random.nextInt(90)+1;
             if ( randomImage <10){
                    imagename="00"+ randomImage +".jpg";
                } else if(randomImage >9) {
                    imagename="0"+ randomImage +".jpg";
                }
          Texture newTexture = new Texture(imagename);
          if(texture== theNameOfTextureInput){
         theNameOfTextureInput=newTexture;
         }
        }
 
     
    