jackmaverick1 has the right answer. The value of names.length is 10, so your program is exploding when k==4.

Consider using a java.util.ArrayList instead.

Oh yes, the subset is a "backed" copy which means that it reflects any changes you make in the original set. Similarly any changes you make in the subset will be reflected in the original. Be careful added members to the subset - the original limits (606 to 630 inclusive) still apply. If you try to add a value outside this range the subset will throw an exception.

All kinds of things happening here...

Firstly, you're passing in a parameter of [ICODE]char unit2[/ICODE] but that parameter never gets used in the routine. So presumably unit is a numeric class member of some kind that your method can use. Is that what you want?

Secondly, in the method displayData, you're using variables called none2. unit2 and amount2 but they aren't declared in the method. So if they aren't class members then they don't exist at all outside the scope of convertLiquid.

You have to remember that your parameters are [I]local[/I] to the method that declares them - nowhere else. Also, the names of your parameters are [I]independent[/I] of the names of the variables you want to pass into the method - they don't have to be the same as anything outside the method. In fact, it's better if they're not otherwise you get difficult-to-track shadowing situations where parameters and local variables hide class members.

I suspect - although this is a guess-by-God - that you intend your call to ready something like this: [ICODE]c.println ("Your amount is " + amount + " converted to " + convertLiquid (-1.0, unit, amount));[/ICODE]

And your convertLiquid method should (perhaps) be using unit2 rather than unit...

The third thing is that this is an awfully ugly way of doing your conversion method, although as a student you may not have learned a better way yet. You could use an array.
[CODE]double [] convertFactors = {33.8140227, 0.001, 1000,
0.00852167911, 4.22675284, 202.884136, 67.6280454,
0.264172052, 1.05668821, ...

Okay, you're good with supplying a JTable with data, so I'll stick with the db side of things. I presume you're able to get a db connection going. This is very platform-specific and I'd need detailed information to help with that side. Here is the code I would use (using a method to show where the connection is coming from):

[CODE]import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.ResultSet;

List loadEmployees (Connection dbConn) throws SQLException {
List empList = new ArrayList ();
Statement stmt = dbConn.createStatement (ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
ResultSet rs = stmt.executeQuery ("Select id,fname,lname,dep From Employee");
while (rs.next ()) {
empList.add (new Employee (rs)); // for the sake of argument...
rs.close ();
stmt.close ();
return empList;

This code will return with an arraylist similar to what you would end up with if you'd read it from a text file.

Hope that helps...