Sample Code:
Task T = new Task();
T.Type = ‘Email’;
T.Description = ”; //string
T.OwnerId = ”; //user id
T.WhatId = ”; //record id
insert T;
Cheers!!!