'Long variable' the same as 'long variable'? will they both compile?
2) i wrote a small program, and the named the CLASS Fruit. I then saved the file as fruit.java (notice the capitalization) . When i typed javac fruit.java, an error was given, however when i type javac Fruit.java(even thought the file doesnt exist), the program complies to a class file. why is that??
3) In a program i declare ' long ali=1L'
later in the program i wish to change the value of 'ali' to 8
1) Long and "long" are not the same. The all lower case "long" is a primitive type. The variable really holds the bits of a longish number. The capitalized "Long" is a class so your variables holds a pointer to an object of type Long. The bits for the number are inside that object.
Why have a Long class? The Long class has instance and class methods that may be useful, and there are times like putting values in a List where you must use objects, not primitives. Long, Integer, and others like that are often called "wrapper" classes, because they wrap primitive numbers with real objects. Java 5 can automatically convert between primitives and wrappers some times, but it still pays to be fully aware of the difference.
2) Neat experiment. Here's what I get from it: The name you give to Javac must exactly match the class declaration in the file. Windows however ignores case and can find the file "fruit" even when you say "Fruit". I'm a bit surprised the compiler doesn't do more checking, but maybe the Windows version is a bit lazy.
3) Try it and see! [ June 09, 2005: Message edited by: Stan James ]
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop