By Ryan on March 3, 2010
Adding a jar to an eclipse project is normally really easy. I came home from school today after adding the AP Computer Science gridworld jar. I always have to add external libraries twice because at school we have OSX and at home I have Windows, so the file paths don’t match up.
So after trying to [...]
Posted in Java, Tips
By Ryan on February 11, 2010
My Computer Science discovers interesting things sometimes. Recently we were doing a little practice with Exceptions and try-catch blocks. One of our projects was to handle division by zero and not crash the program. That sounds like a ordinary project, but as it turns out, it was a more surprising than anyone would have ever [...]
Posted in Java | Tagged division, double, Java
By Ryan on January 19, 2010
Back to the old Java Grid Stone this week, but hey, it’s fun anyway. This time, it’s Matrix Multiplication. I failed to find sufficiently explained information about this horrid excuse for Java, so I want to help everyone else out.
In java, you’re typically dealing with matrices of int or double. The code I provide below [...]
Posted in Java | Tagged Java, matrix, multiplication, Tips
By Ryan on December 11, 2009
If you have a 64-bit operating system, you might consider taking advantage of the 64-bit version of Java and Eclipse. Once you have installed the 64-bit Java, you’ll probably go to Eclipse.org to grab a copy of your favorite IDE. But it work right.
You’ll need a 64-bit version of Eclipse to work with your 64-bit [...]
Posted in Java, Tips | Tagged 64-bit, eclipse, Java
By Ryan on December 8, 2009
Our favorite development tool, Eclipse, makes it slightly confusing to read files properly inside of a Java program.
To start with, I make a file as anyone would, just a quick right click in the Project Tree, then New and finally to File as in a blank file.
One would assume that a non-java would exist [...]
Posted in Java | Tagged eclipse, Error, Java, read, text file
By Ryan on December 2, 2009
I encountered this error today from copying and pasting a code snippet that was from one of our PDF textbooks.
illegal character /160
After making sure that our brackets matched, methods weren’t variables, variables weren’t methods, we didn’t know what was going on. Everything looked good and clean. So we decided to do the unthinkable: we retyped [...]
Posted in Error, Java | Tagged character, Error, illegal, Java
By Ryan on November 30, 2009
Sometimes you need to use an ArrayList. It can be when you’re lazy or when you want flexibility. Eventually, you’ll want to get away from the ArrayList and use your stores objects as standard object array. Doing this isn’t very complicated but it is slightly hidden.
We’re going to pretend for a moment that we have [...]
Posted in Java | Tagged array, arraylist, Java, objects
By Ryan on November 28, 2009
My computer science teacher encountered this strange string while working with another student one day after class. The assignment was using Scanner and stepping through a string by delimiter.
java.util.Scanner[delimiters=\p{javaWhitespace}+][position=0][match valid=false][need input=false][ source closed = false ][skipped=false][group separator=\,][decimal separator=\.][positive prefix=][negative prefix=\Q-\E][positive suffix=][negative suffix=][NaN string=\Q?\E][infinity string=\Q∞\E]
Doesn’t that looks like a scary mess? Actually, it’s not so bad, [...]
Posted in Java | Tagged Error, Java, message, scanner