They walked out of class by the hundreds of thousands. They spoke in front of fellow students in classrooms and in front of millions on television. They marched on Washington and on large cities and small towns across the country.

The demonstrations against gun violence led by high school and college students this year in many ways opened the door for a generation of young activists and participants who found their voice and tackled a scourge that had taken the lives of their peers.

But even then the question became: Could they sustain that outrage and energy and harness it for political change?

With the midterm elections nearly here, many of the students who took part in marches and organized walkouts on their campuses say those events of February and March flipped a switch. They are engaged and aware of politics like never before. And though many are still too young to vote, they have been active — working on campaigns, encouraging their slightly older peers to vote, knocking on doors, pushing their message on social media.

Chris Fazzari, a senior at River Hill High School in Clarksville, Md., remembers sitting in church earlier this year and coming up with a plan to organize a walkout at his school to protest gun violence. An Eagle Scout, Fazzari believed he had a duty to become involved.

The shooting at Marjory Stoneman Douglas High School in Parkland, Fla., that took 17 lives in February led to calls for walkouts across the country. That was what motivated Fazzari, 17, but there were also more personal reasons. When Fazzari was in seventh grade, a neighbor who was a high school freshman took his life with a gun in a nearby park. In high school, the father of a schoolmate murdered his wife and then shot himself.

“Gun violence is very present in our community — and it’s a cliche upper-middle-class suburban town — so this can happen anywhere,” Fazzari said.

Fazzari worked around the clock for three weeks with classmates to plan the walkout. None of them were quite sure about how many students would take part. On the day of the walkout, more than half the school joined them.

In many ways, the walkout was a giant first step for Fazzari’s activism. In the months since, he has been busy campaigning for a school board candidate and has become a key participant in discussions about school safety.

“Things right now may be scary and saddening, but seeing my community come together and help me with the walkout was very encouraging and empowering,” Fazzari said. “You have to be hopeful, because just curling up in a ball and crying isn’t a very effective way to get change.”

The year 2018 has been a particularly active one for students and young people in politics and civic action. In March, hundreds of thousands of students descended on Washington and cities across the country for the March for Our Lives rallies against gun violence. They voiced their anger and frustration with politics and leaders. They said they would no longer be ignored or remain voiceless when it came to issues, such as gun violence, that affect their lives every day. And they vowed to act.

There are about 31 million people in the United States ages 18 to 24, a little more than 9 percent of the population. If history is any guide, the majority in that group won’t vote Tuesday. Their voting participation rarely tops 50 percent. In the 2014 midterm elections, just over 17 percent of young Americans voted.

But there are signs this year’s election will be different, said Rey Junco, senior researcher at the nonpartisan Center for Information & Research on Civic Learning and Engagement at Tufts University, which focuses on the political and civic involvement of young Americans.

A September poll by the center of 2,087 18- to 24-year-olds showed that 34 percent said they were “extremely likely” to vote this year. That response, Junco said, is more typical in a presidential election year.

According to the poll, the number of youth who said they have engaged in offline activism — a protest, walkout, demonstration or march — has tripled since 2016. Youth who engaged in at least one form of activism that goes beyond signing an online petition or clicking a “like” button were significantly more likely to say they were “extremely likely” to vote in the midterms.

“We can’t say that it is a Parkland effect, but it was certainly fueled in part by Parkland,” Junco said.

Another explanation for the jump in 18- to 24-year-olds who say they plan to vote is a relatively simple one, Junco said.

“If you want people to vote, you should ask them, and we see that happening,” he said. “We see that when people reach out to them and say, ‘Hey, would you vote? Would you register?’ that actually has an impact.”