1. A method for transmitting a device-to-device (D2D) signal by a user equipment (UE) in D2D communication, the method comprising:performing frequency hopping to indexes of physical resource blocks (PRBs) in a resource block pool based on a predefined hopping pattern,
wherein the PRBs in the resource block pool is used for transmitting the D2D signal;
transmitting the D2D signal based on the indexes of PRBs,
wherein the resource block pool includes two resource regions,
wherein the two resource regions are obtained based on an index of a first PRB of the resource block pool and an index of a last PRB of the resource block pool, and
wherein the indexes of the first PRB and the last PRB are informed by higher layer signaling.