You are here:

Java/Array assignment

Advertisement


Question
i am in a beginning level Programming class and we were assigned to basically, from my understanding, create a sort of array list, only using an Array. We have to create an array, then give the user the ability to add, append, prepend, insert, or remove an item from the Array, as well as be able to increase the capacity of the array. i got a little ways, but as soon as i started printing the array to make sure i was doing it right, it returned things like [I@4e0e90  when i would try to add the number 5. i can't figure out what to do!?

Answer
The array classes don't have any special implementation of toString(), you can use: Arrays.toString(yourArray) instead of yourArray.toString() to get a better looking output. Or you can manually iterate though the array yourself and print out each element. (The Arrays class is in java.util package).

Java

All Answers


Answers by Expert:


Ask Experts

Volunteer


Artemus Harper

Expertise

I have a Masters in computer science. I can answer questions on core J2SE, swing and graphics. Please no questions about JSP or J2ME.

Experience

I have experience in Core Java, good background in Java swing/gui, some experience with JNI, Java reflection. Some experience in bio-informatics. Basics in c++ and c#

Organizations
Washington State University

Education/Credentials
MS in Computer Science from Washington State University and a BS in Mathematics and Computer Science from Central Washington University.

©2012 About.com, a part of The New York Times Company. All rights reserved.