What are the practical benefits, if any, of importing a specific class rather than an entire package (e.g., import java.net.* versus import java.net.Socket)?

John Mitchell

It's primarily a question of style. Some people prefer to explicitly list each class that is being used/imported by a class while others find that practice of little benefit and some annoyance. It makes no difference in the generated class files since only the classes that are actually used are referenced by the generated class file.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact