File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why more classes is created

 
deepak mehta
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Elouise Kivineva
Ranch Hand
Posts: 154
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 172
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mike Gershman
Ranch Hand
Posts: 1272
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic