| Author |
what is "int.class"?
|
Jack Horner
Greenhorn
Joined: Feb 22, 2005
Posts: 6
|
|
Hello ,everyone what is "int.class"and how can i use it? Thanks
|
 |
Svend Rost
Ranch Hand
Joined: Oct 23, 2002
Posts: 904
|
|
Hi Jack, Do you mean the Integer class, or do you mean a file called "int.class" that you have on your harddisk? Im assuming you mean a file int.class in the following: When you wan't to make a program/application in Java, you start with a Java file, e.g. Int.java. In this file you write Java code. When you have written enough code, you have to "compile" the java file, which you do by the following command: >javac Int.java That will create the file "int.class", assuming there arn't any errors in the code of Int.java. Back to your question: a .class file is bytecode, and contains everything the Java Virtuel Machine (JVM) needs to know about your java class. For more information about the organization of the .class files I'd recommend you to goto Javaworld and search for "class file". How do you use it? Assuming the java class has the "static void main(String[] args)" method you can execute with the following command: >java int If the java class is more of a "helper" class, you can use the class in your programs. Just as you use the normal Java classes like Vector, Math and so on. /Svend Rost
|
 |
Jack Horner
Greenhorn
Joined: Feb 22, 2005
Posts: 6
|
|
thanks for your explanation
|
 |
Mike Gershman
Ranch Hand
Joined: Mar 13, 2004
Posts: 1272
|
|
There is a file int.class. The Integer wrapper class contains a constant, Integer.TYPE, which is a reference to this class file. It is used in reflection operations to represent the int primitives. The following code will display the int class file for you.
|
Mike Gershman
SCJP 1.4, SCWCD in process
|
 |
 |
|
|
subject: what is "int.class"?
|
|
|