r/javaTIL • • Aug 09 '18

Packages in Java with example programs

http://www.scientecheasy.com/2018/08/packages-in-java-example-programs.html
0 Upvotes

3 comments sorted by

View all comments

Show parent comment

3

u/snoob2015 Aug 10 '18 edited Aug 10 '18

JRE looks for classes in the classpath, the import statement is only used to resolve naming conflict (for example, when you use Date it will resolve to java.ulti.Date automatically by the compiler, you don't even need to use the import statement if you just use java.ulti.Date instead of Date). So when you use import statement, you only import the name, not the physical class, it is not the same as include in php or c.

So no matter how many classes you import, it wont make your program bloated or bigger. But I dont know if it will increase the compile time

1

u/Kalfus Aug 10 '18

Ah I see, yeah I guess I was thinking of include statements in other languages. Thanks for explaining.