can't not show header title in JTable
import javax.swing.*;
publicclass TryJTableextends JFrame
{
Object[] columnNames ={"First Name",
"Last Name",
"Sport",
"# of Years",
"Vegetarian"};
Object[][] data ={
{"Mary","Campione",
"Snowboarding",new Integer(5),new Boolean(false)},
{"Alison","Huml",
"Rowing",new Integer(3),new Boolean(true)},
{"Kathy","Walrath",
"Knitting",new Integer(2),new Boolean(false)},
{"Sharon","Zakhour",
"Speed reading",new Integer(20),new Boolean(true)},
{"Philip","Milne",
"Pool",new Integer(10),new Boolean(false)}
};
JTable table =new JTable(data, columnNames);
public TryJTable()
{
getContentPane().add(table);
setVisible(true);
}
publicstaticvoid main(String [] args)
{
new TryJTable();
}
}
i can't show header title in my code, how can i show it?

