It is easy if you know about quotient rings, e.g. $\rm\:\Bbb Z/n^2,\ \Bbb Z[x]/(x^2).\:$ If you don't know about quotient rings, is there still a simple example? Yes! One quickly checks that $\rm\,\Bbb Z^2$ is a ring under pointwise addition and multiplication and, that the set of linear maps on $\rm\,\Bbb Z^2\,$ form a ring under addition and map composition. Now note that the (right) shift map $\rm\: S(a,b) = (0,a)\:$ is linear, and $\rm\,S^2 = 0\,$ since $\rm\: S^2(a,b) = S(0,a) = (0,0).\:$
Remark $ $ If you know matrix rings, note that the matrix of the shift map is that in Thomas's answer. But knowledge of matrices is not required to understand the above simple example.
Where does this example come from? It arises from a general construction. It is, in fact, a linear representation of the generic example $\rm\:R[x]/(x^2),\:$ whose additive group is $\rm\:R^2,\:$ where $\rm\:x\:$ acts as a (right) shift map $\rm\:x(a+bx) = 0+ax,\:$ i.e. $\rm\:(a,b)\mapsto (0,a).\:$ Similarly any ring $\rm\,R\,$ has such a linear representation as a subring of the ring of linear maps on its underling additive group - the so-called (left) regular representation of $\rm\,R.\:$ This is a ring-theoretic analogue of Cayley's theorem, that a group $\rm\,G\,$ may be represented as a subgroup of the group of bijections (permutations) on $\rm\,G.\:$ In both cases the representation arises by sending each element $\rm\:r\:$ into its associated (left) multiplication map $\rm\: x\:\to\:r\:x\:.\:$ See this MO question for further discussion.
As another important example, this view provides a natural way to construct the polynomial ring $\rm\,R[x]\,$ as a subring of the ring of linear maps on $\rm\,R^\Bbb N = (f_0,f_1,f_2,\ldots)\:$ generated by $\rm\,R\,$ and $\rm\,x\,$ i.e. by all constants $\rm\:(r,0,0,\ldots)$ and by the shift map $\rm\,x : (f_0,f_1,f_2,\ldots)\mapsto (0,f_0,f_1,\ldots).$ See also the presentation in this post.
It is worth emphasis that the ring $\rm\:R[x]/(x^2)\:$ is known as the algebra of dual numbers over $\rm\,R,\,$ and that it frequently proves quite handy in various contexts, e.g. when studying (higher) derivatives, or tangent/jet spaces, and when transferring properties of homomorphisms to derivations