To get the current User Id in Apex Class, we can use getUserId() method of UserInfo System Class.