First run Peter's Query in your DBMS and see how the results are displayed.
Next if your JDBC concepts are good go to my second link first (the one pointing to the javadocs of the ResultSet interface).
If the answer still doesn't click, then I guess you will need to go through the tutorial till you get what you want.
Trust me if you find and correct these small mistakes yourself, you will know how to go about larger problems.
Also I will tell you where you are going wrong you are expecting all the three parameters for SL,PL and CL in one row like:.
Whereas when you run the query given by Peter attached with the
order by clause as shown here:-
SELECT m_leavetype, m_bal
FROM TABLENAME
WHERE m_emp_no='1004' ORDER BY (m_leavetype);
Note the use of the order by clause to force the database to sort the way the records are stored in your ResultSet so that you will always get "cl", "pl" and "sl" in that order in your ResultSet and not in the order their rows were inserted.
You would get three rows like this:-
m_leavetype m_bal
cl 7
pl 30
sl 7
So you have to just change your code to search for CL,PL and SL vertically rather than horizontally(i.e in one row).