BEIJING--A former student went on a stabbing rampage at a vocational college in eastern China, killing eight people and injuring 17, police said on Sunday, just days after the deadliest attack in the country in a decade.

Saturday's knife attack took place at the Wuxi Vocational College of Arts and Technology in Yixing, part of Wuxi city in the eastern province of Jiangsu. The suspect, a 21-year-old man, was arrested at the scene and confessed, police said.

Also on Saturday, authorities in the southern Chinese city of Zhuhai said they had charged a 62-year-old man after he rammed his car into a crowd outside a sports stadium, killing 35 people and injuring 43 on Monday night.

In both cases, the suspects lashed out with fatal violence against unrelated bystanders after suffering an economic loss, according to the sparse details released by police.

The killings touched off a rare and heavily censored online discussion over mental health in China, deeper stresses as the world's second-largest economy slows and whether young people will find themselves worse off than generations before them that benefited from China's rapid development.

At least six other high-profile knife attacks have been recorded this year across China.

Police in Wuxi said the stabbing suspect was angry over not getting his graduation certificate and failing an exam.

"According to preliminary investigations, the suspect... attacked others after failing an exam and not receiving his graduation certificate, as well as being dissatisfied with his internship compensation," the Yixing Public Security Bureau said in a statement.

The Zhuhai suspect was reportedly angry at the terms of a divorce settlement, police there said.

Qu Weiguo, a Fudan University professor, said the recent cases of "indiscriminate revenge against society" in China had some common features: disadvantaged suspects, many with mental health issues, who believed that they had been treated unfairly and who felt they had no other way to be heard.

"It is important to establish a social safety net and a psychological counselling mechanism, but in order to minimise such cases, the most effective way is to open public channels that can monitor and expose the use of power," Qu posted on the Chinese social media platform Weibo.

The short essay had been removed by the censors by Sunday afternoon.

Wuxi Vocational College offers courses to prepare students to work in industries including wire and cable manufacturing, interior design, marketing and other fields, its website says.

The junior college and others like it are part of a drive to direct more young people into job-specific training instead of oversubscribed universities. That movement has been held back by the stigma attached to vocational college instead of a competitive university, analysts say.

Trending online discussion topics over the past year have put a focus on the diminished optimism in China about a turnaround for jobs, income and opportunity. One of those - "the garbage time of history" - took off in the summer as a shorthand for economic despair.

In recent weeks, Chinese officials have rolled out a raft of stimulus measures to revive the economy. Monday's car attack also prompted an intervention by President Xi Jinping, who urged local police to "strengthen their control of risks" by identifying people at risk of lashing out.

One online commentator said the Wuxi attack appeared to reflect a sense of entitlement for a generation that had not expected hardship, a "giant baby mentality".

"Always thinking that they are so aggrieved: 'Everyone is persecuting me, I study and struggle just to be a beast of burden'," the person wrote on Weibo on Sunday.