Arguments to constructor evaluated in wrong order.

Mark J. Roberts
Mon May 28 11:02:00 GMT 2001

import java.util.StringTokenizer;

public class Bug {
    public static void main(String[] args) {
        StringTokenizer s = new StringTokenizer("one two", " ");
        Bug b = new Bug(s.nextToken(), s.nextToken());

    Bug(String one, String two) {
        System.out.println("one: "+one);
        System.out.println("two: "+two);

mjr::mjr$ javac
mjr::mjr$ java -cp . Bug
one: one
two: two
mjr::mjr$ gcj --main=Bug -o bug
mjr::mjr$ ./bug
one: two
two: one

I'm running a build of the 3.0 branch from a couple days ago. Methods
don't have this problem, it's only constructors, afaict.

" must be held that third-party electronic monitoring, subject
only to the self-restraint of law enforcement officials, has no place
in our society..." Mark Roberts |

More information about the Java mailing list