• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help needed to assign a study from arraylist to student arraylist  RSS feed

 
Iwan van den Hoek
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have been following a course in Java and with my latest assignment, I am running into a nullpointer exception each time I want to create a new student or Scholer with a given study or course.
It is a GUI based program. It consists of 7 classes and one GUI class. The superclass is StudenAdministratie that has assosiactions with Student and Study. Student has 2 subclasses RegulierStudent and Scholer. Studie has 2 subclasses CPP and Opleiding.
In Student administration I have 2 Arraylists one for students and one for Study's and courses. A student can be a RegulierStudent with a study or a scholer with a course, but not both.
The GUI has 4 tabs, the first tab is to create a student with a study chosen from a jcombobox.
The second tab creates a scholer with a course chosen from a jcombobox
The third tab is to add points or modules to the existing students and show the info
the fourth tab is toString that shows all the info per student.

I have written all the code but am stuck on the maakStudent Method and maakScholer method.
Any help is welcome

I have added the Gui as attachment, sorry for all the code I wanted to add it as zip file but that is not allowed.






 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37513
554
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iwan,
That's a lot of code! Can you narrow it down to create a Small Self Contained Example? This let you get rid of the classes that aren't causing problems. Also, I don't see a main method so I'm not clear on how you run the code or what line the error occurs on.
 
Iwan van den Hoek
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:Iwan,
That's a lot of code! Can you narrow it down to create a Small Self Contained Example? This let you get rid of the classes that aren't causing problems. Also, I don't see a main method so I'm not clear on how you run the code or what line the error occurs on.


Hi Jeanne,

Thank you for responding, I am not familiar with SSCE.

I did attach the GUI code as it was alot of code, I could send you the complete source code.
I can't attach .java or .txt files so I have placed in a code fragment sorry.
The need for the classes is too understand the inheritance within OO Java.

The Gui has a Pull down menu with a String Value if the String value corresponds with a Study in the Arraylist, it needs to add it to the student with that study to the Student Arraylist
The code that is not working is In StudentAdministratie Class:


This part of the Gui Code executes it:

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37513
554
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't want the complete code. I want you to narrow down the problem. This consists of telling us exactly where the error is and narrowing down the problem. Do you need a GUI to reproduce the problem? How much of the code can you remove and have the problem still exist?

I don't expect you to be familiar with what a SSCCE is. That's why I provided a link describing it. This is a valuable troubleshooting technique.
 
Knute Snortum
Sheriff
Posts: 4287
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You say the code is "not working." Could you be more specific?
 
Iwan van den Hoek
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute Snortum wrote:You say the code is "not working." Could you be more specific?


The Method to create a student as I have described is resulting in a nullpointer exception.

We were given a GUI and we need to create the code to use the GUI.

The Guis has a Text box, here you fill in the name of the student. With the pulldown menu from the Jcombbox you select a study.
You press teh button and it should execute the maakStudent method and add the student with the given study to an ArrayList studenten.

The moment I hit the button/execute the method it throws a Nullpointer exception

If you need the Gui code just let me know.

 
Knute Snortum
Sheriff
Posts: 4287
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the full message of the error, including the stack trace?
 
Iwan van den Hoek
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute Snortum wrote:Can you post the full message of the error, including the stack trace?


Here is the error:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at studentadmingui.StudentAdminFrame.studentButtonAction(StudentAdminFrame.java:75)
at studentadmingui.StudentAdminFrame.access$3(StudentAdminFrame.java:73)
at studentadmingui.StudentAdminFrame$4.actionPerformed(StudentAdminFrame.java:379)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
 
Knute Snortum
Sheriff
Posts: 4287
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The important part of the stack trace for you is here:
  studentadmingui.StudentAdminFrame.studentButtonAction(StudentAdminFrame.java:75)
It say that the error occurred on line 75 of a class called StudentAdminFrame in a method called studentButtonAction. Could you post this class or at least the method?
 
Iwan van den Hoek
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute Snortum wrote:The important part of the stack trace for you is here:
  studentadmingui.StudentAdminFrame.studentButtonAction(StudentAdminFrame.java:75)
It say that the error occurred on line 75 of a class called StudentAdminFrame in a method called studentButtonAction. Could you post this class or at least the method?


Hi Knutte,

Here is the GUI code:

 
Knute Snortum
Sheriff
Posts: 4287
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So something on this line can throw a NullPointerException (NPE). Do you know what it is?
 
Iwan van den Hoek
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute Snortum wrote:So something on this line can throw a NullPointerException (NPE). Do you know what it is?


Hi Knutte,

I don't know exactly what the problem is, I think it is a combination of the method maakStudent and the studentbuttoaction.
the mthod maakStudent is causing the Nullpointer I think.

I have to add a student based on the textfield in the Gui to the Studenten ArrayList and check the already filled Opleidingen Arraylist for the Study based in the selected pulldown menu.
I have to combine the student with the study from the arraylist.

Hope this clarify it.
 
Iwan van den Hoek
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Knutte,

I have discoverd that I am doing something wrong with the construcor in the class RegulierStudent
This is the constructor but the Opleiding is null;



I should do something like this I think:

 
Knute Snortum
Sheriff
Posts: 4287
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like studentTextField can be null. Maybe you didn't call getStudentTextField() before studentButtonAction()?
 
Knute Snortum
Sheriff
Posts: 4287
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I don't think that's necessary, and it could throw a NPE.
 
Iwan van den Hoek
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute Snortum wrote:
I don't think that's necessary, and it could throw a NPE.


Hi Knutte,

I am calling the getText and I could be that I am doing something wrong with the maakStudent.

I need to add the new student in for loop and then search for the correct study.

I just need to figure out how to do that

 
Iwan van den Hoek
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute Snortum wrote:
I don't think that's necessary, and it could throw a NPE.


Hi Knutte,

I think it should be something like this although it's not working:

 
Knute Snortum
Sheriff
Posts: 4287
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute Snortum wrote:It looks like studentTextField can be null. Maybe you didn't call getStudentTextField() before studentButtonAction()?

I still think this is the problem.
 
Iwan van den Hoek
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute Snortum wrote:
Knute Snortum wrote:It looks like studentTextField can be null. Maybe you didn't call getStudentTextField() before studentButtonAction()?

I still think this is the problem.


Hi knuute,

In the Gui I execute the following code

I tried to put studentTextField.getText(); above he admin.maakStudent, but still no go.
 
Knute Snortum
Sheriff
Posts: 4287
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think studentTextField is null.
 
Iwan van den Hoek
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute Snortum wrote:I think studentTextField is null.


Hi Knute,

How can I solve that problem?
 
Campbell Ritchie
Marshal
Posts: 56592
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have come late to this discussion after Knute has done all the work.
Don't initialise fields to null. Don't rely on methods to test for nullity; obviously you are trying to use that field before it is given a real value. Remove the == null test from all methods. Write a constructor for your class and initialise all fields, including that text component, to real values.

Remember field means a piece of information contained in the class or object, not a kind of text component.
 
Carey Brown
Saloon Keeper
Posts: 3329
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might want to try
 
Iwan van den Hoek
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:I have come late to this discussion after Knute has done all the work.
Don't initialise fields to null. Don't rely on methods to test for nullity; obviously you are trying to use that field before it is given a real value. Remove the == null test from all methods. Write a constructor for your class and initialise all fields, including that text component, to real values.

Remember field means a piece of information contained in the class or object, not a kind of text component.


Hi Campbell,

Thank you for joining the discussion:

We got the studentAdminFrame form the teacher and I know creating null doesn't help with testing.
The text field is like this, what is wrong with this:

 
Iwan van den Hoek
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carey Brown wrote:You might want to try


Hi Carey,

Thank you for joining the discussion, I tried your code, but it still gets the Null Pointer:

I changed the method maakStudent, but I think there is something wrong there too:
 
Carey Brown
Saloon Keeper
Posts: 3329
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I didn't take it far enough. Try



In your original code (above) for this, if you are getting a NPE on this line, it can only be one of:
  • admin
  • studentTextField
  • opleidingComboBox

  • Insert three print statements for these variables just before line 75 to see which one is null.

     
    Campbell Ritchie
    Marshal
    Posts: 56592
    172
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Iwan van den Hoek wrote:. . . what is wrong with this:
    . . .
    Everything.

    You are confusing the field and a local variable. You are doing something in a method which ought to be done in the constructor. You are using setBounds which suggests you are not using a layout correctly. The only thing which would make that method worse would be to give it public access.

    The method with the for‑each loop is an incorrect use of a List. In fact it suggests to me you do not want a List at all, but a different data structure.
     
    Knute Snortum
    Sheriff
    Posts: 4287
    127
    Chrome Eclipse IDE Java Postgres Database VI Editor
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    You really shouldn't have the initialization of the fields in the getters. You have an initialize() method; why not use it to initialize your fields?

     
    Iwan van den Hoek
    Ranch Hand
    Posts: 40
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Campbell Ritchie wrote:
    Iwan van den Hoek wrote:. . . what is wrong with this:
    . . .
    Everything.

    You are confusing the field and a local variable. You are doing something in a method which ought to be done in the constructor. You are using setBounds which suggests you are not using a layout correctly. The only thing which would make that method worse would be to give it public access.

    The method with the for‑each loop is an incorrect use of a List. In fact it suggests to me you do not want a List at all, but a different data structure.


    Okay thank you for pointing that out to me so clearly.
    I will notify the Teacher that his code is wrong.

    I don't want a different data structure.

    In my first post I explained the assignment and what I want to achieve.
    I want to add a Student with a string to an Arraylist and add the study that is chosen from the JcomboBox with that student. the study and courses are in a different arraylist opleidingen. So I need to go through that ArrayList and apoint the correct study to the student so the name of the student and the corresponding study are added to the Arraylist studenten.

    Hope this help
     
    Iwan van den Hoek
    Ranch Hand
    Posts: 40
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Carey Brown wrote:I think I didn't take it far enough. Try



    In your original code (above) for this, if you are getting a NPE on this line, it can only be one of:
  • admin
  • studentTextField
  • opleidingComboBox

  • Insert three print statements for these variables just before line 75 to see which one is null.



    Hi Carey,

    Thank you, I will try that and let you know the outcome
     
    Knute Snortum
    Sheriff
    Posts: 4287
    127
    Chrome Eclipse IDE Java Postgres Database VI Editor
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I will notify the Teacher that his code is wrong.

    Okay, maybe don't do that, but be aware that there are better ways to code this.
    I don't want a different data structure.

    Well okay, but what you are describing would really lend itself to a Map of some kind. Your "loop through the students" use of a List will work fine, though (if more slowly).
     
    Iwan van den Hoek
    Ranch Hand
    Posts: 40
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Knute Snortum wrote:
    I will notify the Teacher that his code is wrong.

    Okay, maybe don't do that, but be aware that there are better ways to code this.
    I don't want a different data structure.

    Well okay, but what you are describing would really lend itself to a Map of some kind. Your "loop through the students" use of a List will work fine, though (if more slowly).


    Hi Knutte and Carey,

    I have tested it with System.out.println and admin was causing the Nullpointer. Whoohoo

    So the Nullpointer is gone, but now I need to get the correct info in it and that is not going as planned.
    What could I do to fix the below method to get a new student with the corresonding study in the ArrayList


     
    Knute Snortum
    Sheriff
    Posts: 4287
    127
    Chrome Eclipse IDE Java Postgres Database VI Editor
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Well, what's not happening? I take it that the student isn't getting added to the students array. If so, then when I look at this code...

    ... I see two things. If opleiding isn't an instance of Opleiding or richting doesn't equal the NaamStudie.

    So why does opleiding have to be an instance of Opleiding? From a syntactical point of view, it doesn't. Being a Studie is good enough. Is there a logical reason? Using instanceof is often a red flag that the design is poor.

    Next, you pass in richting and test it against NaamStudie. What stops there from being no name equal to richting? Or several names? You might want to use an enum for this rather than a String.

    So again, to debug, use System.out.println (SOP) to print whether opleiding is an instance of Opleiding and if richting equals the NaamStudie. But keep in mind that there are better ways to accomplish what you're trying to do.
     
    Iwan van den Hoek
    Ranch Hand
    Posts: 40
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Knute Snortum wrote:Well, what's not happening? I take it that the student isn't getting added to the students array. If so, then when I look at this code...

    ... I see two things. If opleiding isn't an instance of Opleiding or richting doesn't equal the NaamStudie.

    So why does opleiding have to be an instance of Opleiding? From a syntactical point of view, it doesn't. Being a Studie is good enough. Is there a logical reason? Using instanceof is often a red flag that the design is poor.

    Next, you pass in richting and test it against NaamStudie. What stops there from being no name equal to richting? Or several names? You might want to use an enum for this rather than a String.

    So again, to debug, use System.out.println (SOP) to print whether opleiding is an instance of Opleiding and if richting equals the NaamStudie. But keep in mind that there are better ways to accomplish what you're trying to do.


    Hi Knute,

    Thank you for replying again.

    I am not sure if the use of instanceof is a good thing, I guess not as you are more experienced.

    All I need to accomplish is to check the ArrayList opleidingen with the given String Value from the JCombBox and then connect the study with the Student so it is added to the ArrayList studenten.

    If there is a better way to do that I would love to know
     
    Iwan van den Hoek
    Ranch Hand
    Posts: 40
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Knute Snortum wrote:Well, what's not happening? I take it that the student isn't getting added to the students array. If so, then when I look at this code...

    ... I see two things. If opleiding isn't an instance of Opleiding or richting doesn't equal the NaamStudie.

    So why does opleiding have to be an instance of Opleiding? From a syntactical point of view, it doesn't. Being a Studie is good enough. Is there a logical reason? Using instanceof is often a red flag that the design is poor.

    Next, you pass in richting and test it against NaamStudie. What stops there from being no name equal to richting? Or several names? You might want to use an enum for this rather than a String.

    So again, to debug, use System.out.println (SOP) to print whether opleiding is an instance of Opleiding and if richting equals the NaamStudie. But keep in mind that there are better ways to accomplish what you're trying to do.


    Well You are right again, it is not doing anything.

    So it justs skips the for loop as it doesn't equal anything. I also tried the following but nothing.



     
    Liutauras Vilda
    Sheriff
    Posts: 4928
    334
    BSD
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Iwan van den Hoek, I am looking only at your latest post and have a feeling, that you didn't decompose your method enough. In effect of that, your method does something different than its name suggests. And most likely it does more than it should, so your confusion is absolutely understandable.

    Could you please explain in english, what this method suppose to be doing?

     
    Iwan van den Hoek
    Ranch Hand
    Posts: 40
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Liutauras Vilda wrote:Iwan van den Hoek, I am looking only at your latest post and have a feeling, that you didn't decompose your method enough. In effect of that, your method does something different than its name suggests. And most likely it does more than it should, so your confusion is absolutely understandable.

    Could you please explain in english, what this method suppose to be doing?



    Hi Liutauras,

    Thank you joining the discussion, I really appreciate it.
    Here is what I want to accomplish with the method.

    In Student administration I have 2 Arraylists one for students and one for Study's and courses. A student can be a RegulierStudent with a study or a scholer with a course, but not both.
    I have to add a student based on the textfield in the Gui to the studenten ArrayList and check the already filled opleidingen Arraylist for the Study based on the selected String value in the pulldown menu from the Jcombobox.
    if the chosen String value corresponds with a Value in the opleidingen ArrayList I want to add the student with that particular study/course to the studenten Arraylist.

    So basically I want to create a new Student with the selected study and add it to the studenten ArrayList, so that I can manage the student, add points and get info on the student etc.

    Hope this helps
     
    Liutauras Vilda
    Sheriff
    Posts: 4928
    334
    BSD
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    No no, wait. That is the problem. You're telling how you need to do it without knowing what you need to do. Don't use any Java terms, we're not interested in those - we know some ourselves.
    Don't tell anything about the GUI, problem most likely is not there. Don't even use your variable names in explanation, these could be not accurately chosen and they are in other language.

    Iwan van den Hoek wrote:A student can be a RegulierStudent with a study or a scholer with a course, but not both.
    Not sure understood that. Is regular student the one who enrolled to a full study programme, and the other type is the one who only enrolled to a one particular module to study?

    Elaborate and expand more the quote below, this one is the way closer to what we want to hear from you.
    Iwan van den Hoek wrote:... I want to create a new Student with the selected study...

    Before you tell us in non technical language what is the exact task, please read tutorials StopCoding and WhatNotHow.

    Note: The way you tried to solve this exercise, gave you the result you have now, if you're going to continue solving that way, the result going to be the same. So read those tutorials, and describe the task in plain english (in details, but without technical terminology).
     
    Carey Brown
    Saloon Keeper
    Posts: 3329
    46
    Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Iwan van den Hoek wrote:In Student administration I have 2 Arraylists one for students and one for Study's and courses. A student can be a RegulierStudent with a study or a scholer with a course, but not both.
    I have to add a student based on the textfield in the Gui to the studenten ArrayList and check the already filled opleidingen Arraylist for the Study based on the selected String value in the pulldown menu from the Jcombobox.
    if the chosen String value corresponds with a Value in the opleidingen ArrayList I want to add the student with that particular study/course to the studenten Arraylist.

    In pseudo code (is this correct?)
     
    Knute Snortum
    Sheriff
    Posts: 4287
    127
    Chrome Eclipse IDE Java Postgres Database VI Editor
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    In the opleiding combo box you're putting:

    But in the opleidingen you're putting:

    This is the problem with using Strings the way you are. you should be using an enum.
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!