K
Kevin Simonson
Is there something about the differences between Java versions 1.3.1
and 1.4.2_04 that keeps me from declaring an object of one class when
I just got done compiling that class' definition?
Take a look at my code below. On host "nail", that has version
1.4.2_04 installed, I can write class "Bug" and compile it, and when I
compile class "BugDriver" that declares an object of type "Bug" and
uses it, it compiles fine and runs fine.
On host "star", that has version 1.3.1 installed, I compile the
same "Bug" class, but when I try to compile the same "BugDriver" class
I get an error message and the code doesn't compile.
Does anybody know why this is happening? I wouldn't think there
would be that much differences between two versions of Java.
---Kevin Simonson
"You'll never get to heaven, or even to LA,
if you don't believe there's a way."
from _Why Not_
,------------------------------------------------------------------------------
|nail:Ncl/Java_bash-2.05b$ hostname
|nail.cs.byu.edu
|nail:Ncl/Java_bash-2.05b$ java -version
|java version "1.4.2_04"
|Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
|Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
|nail:Ncl/Java_bash-2.05b$ cat Bug.java
|public class Bug
|{
| int bug;
|
| public Bug ( int bg)
| {
| bug = bg;
| }
|
| public int bugSquared ()
| {
| return bug * bug;
| }
|}
|nail:Ncl/Java_bash-2.05b$ cat BugDriver.java
|public class BugDriver
|{
| public static void main ( String[] arguments)
| {
| System.out.println
| ( "(new Bug( 7)).bugSquared() == " + (new Bug( 7)).bugSquared() + '.');
| }
|}
|nail:Ncl/Java_bash-2.05b$ javac Bug.java
|nail:Ncl/Java_bash-2.05b$ javac BugDriver.java
|nail:Ncl/Java_bash-2.05b$ java BugDriver
|(new Bug( 7)).bugSquared() == 49.
|nail:Ncl/Java_bash-2.05b$
`------------------------------------------------------------------------------
,------------------------------------------------------------------------------
|[kvnsmnsn@star Rid3]$ hostname
|star
|[kvnsmnsn@star Rid3]$ java -version
|java version "1.3.1"
|jdkgcj 0.2.3 (http://www.arklinux.org/projects/jdkgcj)
|gcj (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
|Copyright (C) 2002 Free Software Foundation, Inc.
|This is free software; see the source for copying conditions. There is NO
|warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|[kvnsmnsn@star Rid3]$ cat Bug.java
|public class Bug
|{
| int bug;
|
| public Bug ( int bg)
| {
| bug = bg;
| }
|
| public int bugSquared ()
| {
| return bug * bug;
| }
|}
|[kvnsmnsn@star Rid3]$ cat BugDriver.java
|public class BugDriver
|{
| public static void main ( String[] arguments)
| {
| System.out.println
| ( "(new Bug( 7)).bugSquared() == " + (new Bug( 7)).bugSquared() + '.');
| }
|}
|[kvnsmnsn@star Rid3]$ javac Bug.java
|[kvnsmnsn@star Rid3]$ javac BugDriver.java
|BugDriver.java: In class `BugDriver':
|BugDriver.java: In method `BugDriver.main(java.lang.String[])':
|BugDriver.java:6: Class `Bug' not found in type declaration.
| ( "(new Bug( 7)).bugSquared() == " + (new Bug( 7)).bugSquared() + '.');
| ^
|1 error
|[kvnsmnsn@star Rid3]$
`------------------------------------------------------------------------------
and 1.4.2_04 that keeps me from declaring an object of one class when
I just got done compiling that class' definition?
Take a look at my code below. On host "nail", that has version
1.4.2_04 installed, I can write class "Bug" and compile it, and when I
compile class "BugDriver" that declares an object of type "Bug" and
uses it, it compiles fine and runs fine.
On host "star", that has version 1.3.1 installed, I compile the
same "Bug" class, but when I try to compile the same "BugDriver" class
I get an error message and the code doesn't compile.
Does anybody know why this is happening? I wouldn't think there
would be that much differences between two versions of Java.
---Kevin Simonson
"You'll never get to heaven, or even to LA,
if you don't believe there's a way."
from _Why Not_
,------------------------------------------------------------------------------
|nail:Ncl/Java_bash-2.05b$ hostname
|nail.cs.byu.edu
|nail:Ncl/Java_bash-2.05b$ java -version
|java version "1.4.2_04"
|Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
|Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
|nail:Ncl/Java_bash-2.05b$ cat Bug.java
|public class Bug
|{
| int bug;
|
| public Bug ( int bg)
| {
| bug = bg;
| }
|
| public int bugSquared ()
| {
| return bug * bug;
| }
|}
|nail:Ncl/Java_bash-2.05b$ cat BugDriver.java
|public class BugDriver
|{
| public static void main ( String[] arguments)
| {
| System.out.println
| ( "(new Bug( 7)).bugSquared() == " + (new Bug( 7)).bugSquared() + '.');
| }
|}
|nail:Ncl/Java_bash-2.05b$ javac Bug.java
|nail:Ncl/Java_bash-2.05b$ javac BugDriver.java
|nail:Ncl/Java_bash-2.05b$ java BugDriver
|(new Bug( 7)).bugSquared() == 49.
|nail:Ncl/Java_bash-2.05b$
`------------------------------------------------------------------------------
,------------------------------------------------------------------------------
|[kvnsmnsn@star Rid3]$ hostname
|star
|[kvnsmnsn@star Rid3]$ java -version
|java version "1.3.1"
|jdkgcj 0.2.3 (http://www.arklinux.org/projects/jdkgcj)
|gcj (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
|Copyright (C) 2002 Free Software Foundation, Inc.
|This is free software; see the source for copying conditions. There is NO
|warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|[kvnsmnsn@star Rid3]$ cat Bug.java
|public class Bug
|{
| int bug;
|
| public Bug ( int bg)
| {
| bug = bg;
| }
|
| public int bugSquared ()
| {
| return bug * bug;
| }
|}
|[kvnsmnsn@star Rid3]$ cat BugDriver.java
|public class BugDriver
|{
| public static void main ( String[] arguments)
| {
| System.out.println
| ( "(new Bug( 7)).bugSquared() == " + (new Bug( 7)).bugSquared() + '.');
| }
|}
|[kvnsmnsn@star Rid3]$ javac Bug.java
|[kvnsmnsn@star Rid3]$ javac BugDriver.java
|BugDriver.java: In class `BugDriver':
|BugDriver.java: In method `BugDriver.main(java.lang.String[])':
|BugDriver.java:6: Class `Bug' not found in type declaration.
| ( "(new Bug( 7)).bugSquared() == " + (new Bug( 7)).bugSquared() + '.');
| ^
|1 error
|[kvnsmnsn@star Rid3]$
`------------------------------------------------------------------------------