The 18-year-old freshman who stabbed four people at the University of California’s Merced campus before he was fatally shot was seeking revenge on his classmates because he was kicked out of a study group, investigators said Thursday.