Police officers, magistrates, court officials and defending solicitors staged a mock trial in which a young driver was jailed following a crash.
The play was staged to shock teenagers into realising the importance of road safety.
Students from Longley Park Sixth Form College observed the case at Sheffield Crown Court.
It was based around an 18-year-old driver getting jailed for causing death by dangerous driving after he was passed his mobile phone by his girlfriend and was distracted by two young children in the back of the car.
The students saw the tearful defendant say goodbye to his mother before he was led from court to begin his sentence.
But the court case had been set up by the South Yorkshire Safer Roads Partnership to teach the students about the importance of driving safely and paying attention to the road.
Genuine magistrates, police officers, court officials and solicitors were all involved.
Chris Matthews, a Theatre Studies student from Norton College, who played the defendant, said: “The mock trial was set up to portray the importance of driving safely and paying attention to the road.
“The students really believed it was a real case and were shocked at how serious things can become if you lose concentration on the road for just a split second.”
Patrick Baker, aged 16, from Longley Park Sixth Form College, said “I really can’t imagine being in the position of the defendant.
“Having seen this case in court today I will ask friends not to answer their phones when they’re driving.
“Once I’m driving I will not answer my phone illegally and will keep it turned off or locked away in the boot.”
Joe Hockney, a road safety officer at Sheffield Council, said: “Being distracted for just a split second could have a devastating impact on the rest of your life.”