aspose file tools*
The moose likes Beginning Java and the fly likes why more classes is created Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "why more classes is created" Watch "why more classes is created" New topic
Author

why more classes is created

deepak mehta
Greenhorn

Joined: Jan 25, 2005
Posts: 15
hello mates
sir i want to know that
1. more classes corresponding more classfiles ,why more classfile is created when we compile the source file?


deepak kr.
Elouise Kivineva
Ranch Hand

Joined: Feb 07, 2002
Posts: 154
What you compile is a java file (*.java). Compiling it creates a class file (*.class). If extra class files are created you must have had inner classes and for these class files are also created.
Robert Konigsberg
Ranch Hand

Joined: Jun 23, 2004
Posts: 172
In other words, if you have, in one file:

---Sample.java---
// First class defined
public class Sample {
// Second class defined
class Foo implements Bar {
...
};
private func() {
// Third class defined
blah = new Comparable() {
...
};
}
}

// Fourth class defined
class YaYaYa {
}

See how four separate classes have been defined in this example? One .java file will create four .class files. Why? That's just the way they did it, I don't know.


SCJP 1.4 (91%)<br />SCJD 1.4 (376/400, 94%)
Mike Gershman
Ranch Hand

Joined: Mar 13, 2004
Posts: 1272
Each Java class and interface has its own .class file so that javac and java can locate any class by its fully qualified name using the disk directory of the host operating system.


Mike Gershman
SCJP 1.4, SCWCD in process
 
 
subject: why more classes is created