At times it is good to talk in class. When a teacher asks a question and opens it for discussion, the more people who are willing to talk, the better the discussion will go. If you are willing to do a lot of the talking, you are more likely to learn. It is also good to talk to classmates when the teacher has activities that require it.
There are times when it's inappropriate to talk. You teacher might seem like a stickler if he or she gets upset about little side conversations and chit-chat, but you would be surprised about how difficult it is to teach a lesson when people are talking about something other than the lesson at hand. Besides, you might miss something important. Believe it or not, your teacher doesn't talk because he/she likes the sound of it. We put a lot of time and effort into planning effective lessons for students, so we feel that that effort is wasted if people are talking and not paying attention to what we have to say.