Posts tagged java

Trying to Dig a Little More In-Depth With Maven

I’ve been reading Maven: The Definitive Guide (affiliate link) as a Kindle eBook and finally got to the point of trying the first example project. The book had mentioned that maven might be installed on Mac OS X already (due to usage with some versions of XCode). Magically, it’s there: So far, I like the [...]

Java code to test if a string is a valid java identifier.

public class IdentifierTest {   /** * @param args the command line arguments */ public static void main(String[] args) { for(String arg : args) { boolean start = true; boolean validIdentifier = true; arg.toCharArray() // commenter pointed out my error //for(byte b : arg.getBytes()) { for(char b : arg.toCharArray()) { if(start) { validIdentifier = validIdentifier [...]

How I studied for the Sun Certified Java Programmer [SCJP] 6 Exam

Including an inline review of two SCJP study guides. Disclaimer: This is not a guide to passing the test with zero experience and no preparation. The SCJP exam will quickly expose lack of working knowledge. I have roughly 15 years of experience with programming in C and derivative languages, including about 1 year of Java [...]

Boxing of an Integer and conservation of space in Java

Apparently, boxing of an int literal initialization into an Integer class will result in two different objects being assigned the same space in memory if the number is 127 or smaller, but different spaces in memory if the number is 128 or larger. Take BoxTest.java: public class BoxTest { public static void main(String [] args) [...]