Here is what I did:
I created two files simple.java and simple1.java with the following contents:
simple.java:
---------
import simple1.java;
class demo {
public static void main(String args[]) {
Point p;
p = new Point();
p.display();
}
}
simple1.java:
--------
class Point {
public int x = 10;
public int y = 20;
public void display() {
System.out.print("Point is at: " + x + ", " + y + "\\n");
}
}
Compile this and you get the following crash: (a number of things are clearly incorrect
but the crash shouldnt have occurred!)
[131][java_examples] ? javac simple.java
simple.java:3: Class simple1.java not found in import.
import simple1.java;
^
java.lang.NullPointerException
at java.tools.tree.MethodExpression.inline(MethodExpression.java)
at java.tools.tree.ExpressionStatement.inline(ExpressionStatement.java)
at java.tools.tree.CompoundStatement.inline(CompoundStatement.java)
at java.tools.javac.SourceField.inline(SourceField.java)
at java.tools.javac.SourceField.code(SourceField.java)
at java.tools.javac.SourceClass.compileClass(SourceClass.java)
at java.tools.javac.SourceClass.compile(SourceClass.java)
at java.tools.javac.Main.compile(Main.java)
at java.tools.javac.Main.main(Main.java)
.//simple.java:3: Class simple1.java not found in import.
import simple1.java;
^
.//simple.java:5: Class demo already defined in simple.java.
class demo {
^
.//simple.java:7: Class Point not found in type declaration.
Point p;
^
.//simple.java:9: Class Point not found in new.
p = new Point();
^
.//simple.java:10: Class Point not found in void main(java.lang.String[]).
p.display();
^
error: An exception has occurred in the compiler, please file a bug report (###@###.###).
7 errors
[132][java_examples] ?
I created two files simple.java and simple1.java with the following contents:
simple.java:
---------
import simple1.java;
class demo {
public static void main(String args[]) {
Point p;
p = new Point();
p.display();
}
}
simple1.java:
--------
class Point {
public int x = 10;
public int y = 20;
public void display() {
System.out.print("Point is at: " + x + ", " + y + "\\n");
}
}
Compile this and you get the following crash: (a number of things are clearly incorrect
but the crash shouldnt have occurred!)
[131][java_examples] ? javac simple.java
simple.java:3: Class simple1.java not found in import.
import simple1.java;
^
java.lang.NullPointerException
at java.tools.tree.MethodExpression.inline(MethodExpression.java)
at java.tools.tree.ExpressionStatement.inline(ExpressionStatement.java)
at java.tools.tree.CompoundStatement.inline(CompoundStatement.java)
at java.tools.javac.SourceField.inline(SourceField.java)
at java.tools.javac.SourceField.code(SourceField.java)
at java.tools.javac.SourceClass.compileClass(SourceClass.java)
at java.tools.javac.SourceClass.compile(SourceClass.java)
at java.tools.javac.Main.compile(Main.java)
at java.tools.javac.Main.main(Main.java)
.//simple.java:3: Class simple1.java not found in import.
import simple1.java;
^
.//simple.java:5: Class demo already defined in simple.java.
class demo {
^
.//simple.java:7: Class Point not found in type declaration.
Point p;
^
.//simple.java:9: Class Point not found in new.
p = new Point();
^
.//simple.java:10: Class Point not found in void main(java.lang.String[]).
p.display();
^
error: An exception has occurred in the compiler, please file a bug report (###@###.###).
7 errors
[132][java_examples] ?