Joule 's second law says that the internal energy of a gas does not change if volume and pressure change , but does change if temperature changes . Joule 's second law states that the internal energy of an ideal gas is independent of its volume and pressure , depending only on its temperature .