Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

explain the statement import java.io.File.*;

 
lakshmana dhanimireddi
Greenhorn
Posts: 18
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the meaning of


import java.io.File.*;

class Sample
{
}



the above file class is successfully compiled. But I can't understand the meaning of import statement.

Can you explain?

Thanks,
Lakshmana
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like a mistake to me. It means, if you can't find a class, go and look in the package called java.io.File. Obviously all classes were found, so the compiler didn't have to look in that package. I think it was supposed to have the keyword static in there somewhere.
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or it's trying to import all nested classes / interfaces. It doesn't really matter that there aren't any, the syntax is still legal.
 
lakshmana dhanimireddi
Greenhorn
Posts: 18
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to all.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic