/usr/ceo said:
I'm using Eclipse (Ganymede) on Mac OS X. I'll have to try that. In
general, I'm also learning about the Eclipse-type editing platform,
I'm sure Eclipse has some abbreviation system, but the one is not based
on the other, and I don't know what the key sequence is for Eclipse.
NetBeans = Sun, Eclipse = IBM. IBM also makes it's own GUI (SWT) vs.
Sun's Swing, IBM has their own web container (JBoss), etc. While
competition is good for us programmers, in terms of market I think they
get on like cats and dogs.
This is mainly for
my own use for now.
To be a bit less obtuse, there's still problems with your puts() method.
You can define it to take a variable number of Objects (which includes
Strings), or you can make it take primitives, but you can't mix the two.
void puts( Object ... o ) {}
void puts( int ... i ) {}
These are two overloaded puts() methods, but you still can't put ints in
an array of Objects. Java is more strongly typed than Perl, so it
doesn't allow you to mix the two. However, with concatenation, you can
mix them.
class TestOut {
public static void main ( Strings ... args ) {
int i = 5;
Object o = new Object();
javax.swing.JLabel label = new javax.swing.JLabel( "Hi" );
System.out.println( "I have " + i + " ints and I have " +
"\nthis " + o + " thing here and " +
"\nI have a JLabel " + label + "." +
"\nHave a nice day!"
);
}
}
This is more the Java idiom, and it works pretty well. You're basically
substituting a + for a , which is not any different in typing imo. With
puts(), you still have to type all the parameters, and put a comma after
each one instead of the plus sign I have.
In Java, this is also faster, since calls to the IO system tend to be
slow. The above code creates one single buffer, and send the whole
thing to the println() method in one call. If you use a for loop in
puts(), you have to make multiple calls, and if you call "new" to make
integers into objects (to pass the ints as parameters with Object[]),
then you're getting even more inefficient.
So I think you should just get used to using the abbreviation (whatever
Eclipse uses instead of "sout") and type a + instead of a comma. It'll
help you learn Java, and it's no real extra work. (Note: no code in
this post was tested or compiled.)