Saturday, October 31, 2009

More sunny days in Philadelphia.

Lab 3 Arrays Exercise 1:

Aww… there isn’t a level one in the first exercise. Oh well. Looking at the project in NetBeans it looks as if I am creating the test objects for this one as well. What now? Eclipse. What are you doing? I know. I am happy we can search strings in other strings. We can also use that code along with the java.util.Arrays.toString method to parse the array into text, and that’s great, thanks, but can we please run the project package I am working in, please? Thank you. Now, umm… what were you saying?

So what happened was this. Eclipse had been distracting me by executing a program I had written for a previous lab having to do with searching text with loops and charAt. So, I went to all of this trouble to make a string something like this 1,2,3,4,5. And then I was going to parse it into an array. I think you can tell my programming background is kind of shell and batch oriented. And wouldn’t you know it: Java isn’t ksh or bash it’s Java. Fortunately for me Java makes sense, sort of, especially when you are writing it OO. I actually made this lab a lot harder than it needed to be. I still didn’t peek ahead though(yay me). It wouldn’t have been much of a challenge if I had just created new arrays and set their values with curly braces as the lab instructed, but I wanted more. I had to have an interactive application that polls you for your array length and then requests values for each place while iterating through a count from zero to the array length.

The lab of course taught the lesson that, while arrays are not primitive data types, caution should be taken to assure that in setting two separate arrays to the same starting set will propagate changes to one to them all if their values are assigned as being equal to each other rather than to the same data set.

No comments:

Post a Comment