I created one component before activation of the locker service. After that i created another component after activation of the locker service. But my doubt is how to know, what is the difference between with and without locker service using code. Can anybody explain on this through code.
This is outlined in What is Locker Service? and its related links. What you really need to know is that if you follow the documentation correctly, there is no difference in behavior between having Locker Service and not. What Locker Service does is prohibit certain types of behaviors, such as trying to peek into the DOM of a component outside your own namespace.
For example, Locker Service disallows the following code example:
<lightning:button aura:id="button1" label="My Button" />
var element = component.find("button1").getElement();
In other words, Locker Service makes your code secure so that other components can't modify your component's internal structure. It also protects system elements from being modified in unexpected ways.
There's a lot more than just this, so I really suggest you read the documentation. Locker Service makes your code more secure, but also means that it is more challenging to use because somethings that you think are allowed are not. It's really all about protecting you from writing insecure code.