Shanna Ripley

Greenhorn
+ Follow
since Mar 12, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Shanna Ripley

Thanks Paul for your reply.

I'm still new to this so having a few problems. So I have the toString() method you suggested in the CD class, how do I call that from the code I showed previously. I'm assuming it needs to be called on a CD object.

Thanks for your help
9 years ago
Hi All,

I have stored several objects of type CD (represents details of CD to be stored in a catalogue) into a TreeMap and am trying to retrieve the contents but having trouble.
Example of the code I'm using to populate the TreeMap....


I've tried the following code to print out the details...


This is the output I get...

Michael Jackson: [CD@164f1d0d, CD@23fc4bec, CD@8dc8569]

I guess it's having problems printing out the values of the CD object. Can anyone point me in the right direction of how to do this...I want the details of the CD object also printed out.

Thanks in advance.
9 years ago
Thanks Henry and Fred
10 years ago
Hi All,

I was doing a little test program...multiplying a byte, initialised to 1, by 8. I print out the result after each multiplication.
The results are:
2
4
8
16
32
64
-128
0

Can anyone tell me why the seventh value is -128 (why minus?) and the eighth is 0??
I know the Byte ranges from -128 to 127....I'm guessing that has something to do with it.

Thanks in advance
10 years ago
Thanks everyone. Of course it had to be that simple
10 years ago
Thanks Marc that did the trick

I have one more quick question...I changed the code in compareTo() since I'm using Comparable now...this is what I've got..


It's working but in reverse order...I want the items listed from a to z but this way is organising them z to a. Is there a different method I should be using??

Thanks again
10 years ago
Hi All

I have an ArrayList populated with 'Address' objects. I want to order the contents of the ArrayList using the 'Surname' from the Address objects. I've tried to do this using Comparator but I'm doing something wrong. I get the error message....
"java.lang.ClassCastException: Address cannot be cast to java.lang.Comparable"
Does anyyone have any help or advice about what I'm doing wrong??

My Address Class..


And then I used this line of code in another class where I want to write the contents of the ArrayList to a text file.



Thanks in advance for any help or suggestions
10 years ago
I tried changing the url...



Now I'm getting the error

java.sql.SQLException: Database 'AddressBook' not found.

Jan Cumps wrote:Try to put the Class.forName() piece in the second try block, and remove the first try/catch pair.


Let is now if this fixed your issue.



Unfortunately, it didn't work. Still getting the same error. Thanks for the suggestion though
Hi All

I've just started trying to use JavaDB and have come across a few problems. I have my database set up and now I'm trying to connect to it. I think I set up the classpath for the project successfully but when I run my code I get the error...

java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/AddressBook

This is my code..



After printing the stack trace, the error is at..



I've tried googling this and some posts suggest it's a problem with the url but I've copyed and pasted mine in straight from the database Properties.

I'd appreciate any help or advice on fixing this error.

Thanks in advance
Hi All

I would like to develop a game for my phone. I want a simple game that I can use to help me study Chinese vocabulary. I've never used Java ME before so am unsure how to go about this. I would like to display a picture of a Chinese word and then have to guess the meaning. If I was to do this in another language, I would use a database and store the vocabulary, the English meaning and the location of the image of the Chinese character. Can I do this using Java ME?

Any advice is greatly appreciated

10 years ago

Nitesh Kant wrote:Its important to TellTheDetails.
Normally, an NPE is the most trivial exception to resolve and the line number in the exception will tell you where it occur.




It doesn't mention any line number in my error message. Is there a way that I can print out more info about the error because it is driving me nuts. I'm using NetBeans and all that prints out is "Connection Error: java.lang.NullPointerException"
Hi All

I've been trying to develop my own chat app. I had a simple version working, but now that I'm trying to add extra functionality it's gotten a little more complicated. To implement it the way I want to, I've started to use interfaces. Now when I'm trying to create a simple connection between client and server, I am getting a NullPointerError. I've been trying but figure out how to fix it. Anyone have any ideas??

Thanks in advance

My server code...




This is my code to create a connection.. This is where the error is coming from. This is the error.."Connection Error: java.lang.NullPointerException"

Hi All

I'm trying to create my own instant messenger and have come across a problem. I have a log in form, when the user enters their name. Once they click 'Log In', another window opens displaying the users that are currently online. My problem arises when I want to close the log in form. When I close this the other window that displays the online users also closes. Does anyone know why this happens??

Thanks in advance.




10 years ago

Maneesh Godbole wrote:Recommended reading http://java.sun.com/docs/books/tutorial/uiswing/components/list.html#mutable



Thanks for that but I was hoping someone could lend a hand with how to get the info about the current clients back to be displayed on the gui. i.e how to get the instances of the Users objects stored in the UsersGroup object back to MyClient class. I hope this makes sense and that I'm explaining it properly
10 years ago