File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need some urgent help

 
jon ladd
Ranch Hand
Posts: 53
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need some help i am lost i am getting alot of errors. Right now if you looked at it there ar some errors with the cases I know that. I am having trouble with "x[0] = new Names("Jim", new StringBuffer("CIS"), 15);" it gives me errors about that x in not in the student class.
It also gives me errors with Sets down farther.
If this is to confusing, I can post the whole program with all the cases. But the assigment is confusing too look at becase were are modifying are last program.

 
Layne Lund
Ranch Hand
Posts: 3061
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Will you please paste the exact error messages?
 
William Barnes
Ranch Hand
Posts: 986
Eclipse IDE Firefox Browser Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your setMajors method never actually does an assignment.
 
William Barnes
Ranch Hand
Posts: 986
Eclipse IDE Firefox Browser Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you know what your code is actually doing? Put LOTS of print statements, everywhere, that is how you know. And is one the most important steps of development. You can take them out once you get everything working. (If you have a debugger that is even better.)
 
jon ladd
Ranch Hand
Posts: 53
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK thanks fo the help.
 
Joel McNary
Bartender
Posts: 1824
Eclipse IDE Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, just looking at your code, you state x[0] = new Names etc., but I don't see where you are declaring you array x. What sort of array is it?
 
jon ladd
Ranch Hand
Posts: 53
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok thanks for pointing that out I can not believed I missed that I guess that I was creating an array by having x[0] = new Names("Jim", new StringBuffer("CIS"), 15);. Ok if I put one of these below with that initialize the array. I think that how I want to say it
x[] Names = new x[3];
or would it be
x[] Names = new Names[3];
then go on to this down below
CODE]
x[0] = new Names("Jim", new StringBuffer("CIS"), 15);
x[1] = new Names("Shania", new StringBuffer("ACT"), 35);
x[2] = new Names("Faith", new StringBuffer("MKT"), 13);
[/CODE]
 
Joel McNary
Bartender
Posts: 1824
Eclipse IDE Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by jon ladd:

x[] Names = new x[3];
or would it be
x[] Names = new Names[3];

Neither. You want

or

both will work; one syntax is kept for C programmers used to their syntax (I forget which is which; I use the former).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic