Help me please - simple program

I have a problem with the NullPointerException: null in this programe and the sorting method is not working.

Anyone please help me to solve that problem. Because 5 hours left I have to submit this program.

The source code is here. I am using BlueJ to write the code.

http://files-upload.com/325815/LabTest1.zip.html

Thank You

[357 byte] By [Triagipa] at [2007-11-27 8:55:02]
# 1
You can post the code here. Read this to find out about formatting: http://forum.java.sun.com/help.jspa?sec=formatting
BigDaddyLoveHandlesa at 2007-7-12 21:15:20 > top of Java-index,Java Essentials,Java Programming...
# 2
well thanks...but the code is too long..I will try to post it...
Triagipa at 2007-7-12 21:15:20 > top of Java-index,Java Essentials,Java Programming...
# 3
> well thanks...> but the code is too long..> > I will try to post it...In that case, post a small (< 1 page) example program that demonstrates your problem.Inside every large buggy program is a small error!
BigDaddyLoveHandlesa at 2007-7-12 21:15:20 > top of Java-index,Java Essentials,Java Programming...
# 4

this code is to sort the data and display the sorted data in the JTable.

public void sortProgram() {

Subject sb[] = new Subject[subjects.size()];

for(int i = 0; i < subjects.size(); i++)

sb[i] = (Subject)subjects.get(i);

for(int i = 1; i < subjects.size(); i++)

for(int j = 0; j < subjects.size() - 1; j++) {

if(((sb[j].getProgram()).compareTo(sb[j + 1].getProgram())) > 0) {

Subject cache = sb[j];

sb[j] = sb[j + 1];

sb[j + 1] = cache;

}

}

Vector col = new Vector();

Vector row = new Vector();

Vector rows = new Vector();

col.add("Program Code");

col.add("Course Code");

col.add("Subject Title");

for(int i = 0; i < subjects.size(); i++)

sb[i] = (Subject)subjects.get(i);

for(int c = 0; c < sb.length; c++) {

row.add(sb[c].getProgram());

row.add(sb[c].getCourse());

row.add(sb[c].getSubjectTitle());

rows.add(row);

row = new Vector();

}

Triagipa at 2007-7-12 21:15:20 > top of Java-index,Java Essentials,Java Programming...
# 5
1. What line throws the NPE?2. Why not use a sorting method in the API?
BigDaddyLoveHandlesa at 2007-7-12 21:15:20 > top of Java-index,Java Essentials,Java Programming...
# 6

> 1. What line throws the NPE?

>

> 2. Why not use a sorting method in the API?

1. The problem is the data is not sorted. and the NPE is in another method, not in this method.

2. I also want to use method in the API, but the lecturer expect that kind of sorting method.

Triagipa at 2007-7-12 21:15:20 > top of Java-index,Java Essentials,Java Programming...
# 7
just a though mind you, but have you considered showing some of the code that contains the NPE error?
petes1234a at 2007-7-12 21:15:20 > top of Java-index,Java Essentials,Java Programming...
# 8
Oh.
BigDaddyLoveHandlesa at 2007-7-12 21:15:20 > top of Java-index,Java Essentials,Java Programming...