Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
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
Marshal
Posts: 55751
163
  • 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
Posts: 21092
85
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
Marshal
Posts: 55751
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!