It looked like an ordinary home economics class in sewing. Of course, the room was bitterly cold, and the eight 16-year-olds threading buttons or stitching pockets onto trousers were bundled up in thick cotton-padded jackets and trousers, as were their two teachers.
But so is every one else in heatless Shanghai during the winter.
''Look at this girl's work,'' said one teacher, pointing at a demure lass intently sewing away at a pair of trousers.
''Three months ago, she couldn't sew on a button. Now, her work is nearly of professional quality.''
Asked whether she might like to make a career of tailoring, the girl looked up and smiled shyly.
''Well, yes,'' she said, ''it would be marvelous if I could get a job in a garment factory.''
This is Shanghai's ''work and study'' school, housing 170 pupils from 14 to 18, including 30 girls. Each urban district in Shanghai has one such school.
''We are not a reformatory,'' said Liu Mingfang, the principal. ''Reformatories are places to which courts sentence minors who have committed crimes. We are what we say we are - a school.''
Work and study schools are the Chinese way of tackling juvenile delinquency before it gets to the courts. Every one of the pupils at Mr. Liu's school has run afoul of the police. Some have been in serious street fights with sticks and knives. Some have picked pockets in buses and stores. Some have had illicit sex relations - a practice still regarded far more seriously in China than it is these days in most Western countries.
''For first offenses, police have a certain latitude,'' Mr. Liu said, ''unless the crime is a really serious one. They may keep the child a few hours, make him write a self-criticism, then release him to his school or parent.
''Or they may bring him to us. Usually this does not happen until it is established that a child is a habitual offender, that neither his parents nor his school can cope with him. In any case, it is the police that decide - at a stage before taking a case to court.''
Girls and boys are in separate premises. There are no bars and no locked gates, but pupils are not allowed to leave the campus during the week. Every Saturday they may return home until Sunday evening, as well as during holidays.
The program lasts for two years and is designed to remold a delinquent to a point where he can return to his former school.
The program has three stages, Mr. Liu said. The first one, which lasts for three months, tries to inculcate a sense of right and wrong as well as mutual trust between teacher and pupil, so that a child understands why what he has done is wrong and may even confess to a previously hidden offense.
Teachers from the school visit the child's home, as well as his associates or schoolmates, trying to understand what made the child go wrong in the first place, and to cut off the child from harmful earlier influences.
If this stage is successful, the child goes on to stage two - a year and a half of work and study at the school. Then he is ready to be reinserted into his previous school, to see whether this time he can make the grade. If he cannot, he is taken back.
''This school was revived in 1979, after the downfall of the 'gang of four' and the end of the Cultural Revolution,'' Mr. Liu said. ''Since then, 770 boys and girls have passed through our doors, and only 10 percent has had to come back.''
At a chat with girls in the sewing class, Chen Hua, a bright 16-year-old, said she had been sent to this school because of having had sexual relations with a boy.
''I am glad to be here,'' she said with every appearance of sincerity, ''because the teachers are very kind and take a much more personal interest in us than they did at my other school. Also, we learn from each other.''
A girl sitting next to her broke down and cried when asked to explain her name, Nanxuan - Nan meaning difficult and Xuan being the place in Xinjiang (Sinkiang) where she had been born.
''We ask the girls not to dwell on their past,'' Mr. Liu said. ''What is important is that they learn the right approach to study and to life today. Some of these girls - and boys, too, of course - come from heartbreaking home environments. Sometimes we've got to work as much with parents as we do with our pupils.''
In a physics class for boys, the teacher was explaining what happens to a liquid at a temperature of 180 degrees C. when a substance 50 degrees lower is added to it. Hands kept rising throughout the classroom of some 28 pupils as they vied with one another to work out portions of the formula the teacher was writing on the blackboard. The teacher had a barracks-room voice, but his explanations were to the point and kept the class interested.
''In my previous school,'' said a girl pupil, ''my teachers liked the good students and were not very patient with the backward ones. But here it is different. I used to be very poor in math, but now I like it.''
''The children who come here are not stupid,'' said one of the teachers. ''They were brought to us because they drew attention to themselves, in a bad way. If you can only point them in the right direction, encouraging them to draw attention to themselves in the right way, and make a contribution to society, working with them can be the most rewarding experience in one's life.''