Bill Cosby (search) spoke bluntly to students at Richmond's mostly black public schools Monday, urging them to dedicate themselves to graduation, not gangs, and to control anger that threatens to derail their dreams.

Cosby toured four schools with former Gov. L. Douglas Wilder (search), who is running for mayor. But instead of talking politics, Cosby stuck to his no-nonsense message to inner-city black children that at times has made him the target of criticism.

"Study. That's all. It's not tough. You're not picking cotton. You're not picking up the trash. You're not washing windows. You sit down. You read. You develop your brain," Cosby pleaded at Fred D. Thompson Middle School (search), where 65 percent of the 700 students meet low-income criteria for free or reduced-price lunches.

There and at George Wythe High School, the 67-year-old actor and comedian implored black children in their teens to begin studying in groups, for girls not to allow themselves to get pregnant and for boys not to compensate for love they lack at home with gangs or sex.

"I'd like to tell you I don't think things have changed since I was 14," Cosby said. "There are still old people who drink, do drugs — who will stop and take the time to tell you don't be like them. Have you heard them? Pay attention to them."

Cosby mentioned sex and an auditorium packed with sixth- through eighth-graders buzzed with laughter, catcalls and whistles. Then he mentioned algebra and the room momentarily quieted.

"Everybody knows about sex. Not too many people want to know about algebra," he said.

"Let's think about love. Let's think about where it is and where you can get it, but not sex. You're too young for sex," he said, joking with the children. "You don't have sex 'til you're 50 years old. What, that's too old? Well how about 49?"

In urging young blacks to find self-worth in academics, Cosby's comments were similar to those he made in May in Washington, D.C., when he upbraided some inner-city blacks for squandering opportunities won in the civil rights movement.

Cosby was criticized by some black activists, just as Wilder has been in speaking bluntly in his mayoral race about black poverty, joblessness, crime and what he says is a lack of black leadership in this city of about 195,000.

Wilder and Cosby, however, said the visit grew out of their longtime friendship and its timing three weeks before election day had nothing to do with politics. Wilder, who in 1990 became the nation's first elected black governor, and Cosby, who helped desegregate prime-time television in the 1960s, said Cosby's appearance was not a tacit endorsement. Cosby said he wouldn't consider endorsing Wilder without first meeting his opponents.

"This is not a campaign piece," Wilder said. "I don't think it helps my campaign, I don't think it hurts my campaign."

With a national political portfolio, Wilder's campaign treasury and fame dwarf those of his opponents, including incumbent Mayor Rudolph McCollum.

Cosby was annoyed at the political speculation.

"I'm not running for any office and I think that Gov. Wilder — let's all face it — would not need to set up a smoke screen in order to get the two of us to get some kind of publicity," Cosby said.