You can solve this by gaphical method, i.e.

1. You plot the constraints,taking x1 as x and x2 as y, {feasible region)

2. plot the objective fcn using two different values of z, (iso-lines)

3. observe the direction of 2. as z increases

4. Find out the last point(may also be a segment) in the feasible region which will be touched by an iso line.

if you do this, you'll notice that you're feasible region is a line (the second constraint). The last point of that line that will be touched by the iso lines (iso-lines are actually parallel to the third constraint and it is actually heading towards the direction of the origin) is the point (0,5). This gives you the maximum z=5.

You can also use simplex method but that entails more time and effort. Since your problem involves only two variables, it's much easier to graph.