In general, behavioral psychology seeks to explain behavior by understanding the environment and the stimulus-response relationship, whereas cognitive psychology seeks to explain behavior by understanding the mental representations of knowledge and the processes that manipulate them. In many ways, then, cognitive psychology is an alternative view of behavior than you have studied so far in the course. But it is more than that. It is another field that, like behavioral psychology, uses the experimental method to study behavior. The way in which a cognitive scientist studies behavior is the same as a behaviorist.
Cognitive psychologists use logic to infer mental processes by observing the behavior of people.
We are much like physicists who cannot see the phenomena they study, be they distant stars or aspects of atoms. We infer the rules of behavior by studying the consequences of the presence of mental activity. The mental activity that cognitive psychology examines assumes that information coming in through the senses is represented and held over time by the mind. This is why so much of the time we will spend on cognitive psychology involves memory. We cannot use language unless we represent the symbols or rules of language and hold them over time.