S
Stefan Ram
Sometimes, it is surprising what error messages Java
implementations give:
Main.java:3: error: '.class' expected
{ if( true )int x; }}
^
Does the implementation really expects to see
»if( true )int .class« or »if( true ).class«?
The complete source code was:
public final class Main
{ public static void main( final java.lang.String[] args )
{ if( true )int x; }}
You also can get the error message text »'.class' expected«
with the following programs:
public final class Main
{ public static void main( final java.lang.String[] args )
{ java.lang.System.out.println( args.len[] ); }}
public final class Main
{ public static void main( final java.lang.String[] args )
{ java.lang.System.out.println( args.length[] ); }}
public final class Main
{ public static void main( final java.lang.String[] args )
{ java.lang.System.out.println( int ); }}
(The subject of this message is an automatic translation of
a German idiom that I wanted to use as a subject for this
post. The translation, however, does not express the sense
of the German idiom, nor does it have any sense at all.
However, it fits the topic of the contents, because it
demonstrates once again that automatic translation systems
have problems understanding what humans write, just as the
Java implementation does. The first error message should be
more like: »Statement expected.« [»int x;« is a block
statement, but not a statement.])
implementations give:
Main.java:3: error: '.class' expected
{ if( true )int x; }}
^
Does the implementation really expects to see
»if( true )int .class« or »if( true ).class«?
The complete source code was:
public final class Main
{ public static void main( final java.lang.String[] args )
{ if( true )int x; }}
You also can get the error message text »'.class' expected«
with the following programs:
public final class Main
{ public static void main( final java.lang.String[] args )
{ java.lang.System.out.println( args.len[] ); }}
public final class Main
{ public static void main( final java.lang.String[] args )
{ java.lang.System.out.println( args.length[] ); }}
public final class Main
{ public static void main( final java.lang.String[] args )
{ java.lang.System.out.println( int ); }}
(The subject of this message is an automatic translation of
a German idiom that I wanted to use as a subject for this
post. The translation, however, does not express the sense
of the German idiom, nor does it have any sense at all.
However, it fits the topic of the contents, because it
demonstrates once again that automatic translation systems
have problems understanding what humans write, just as the
Java implementation does. The first error message should be
more like: »Statement expected.« [»int x;« is a block
statement, but not a statement.])