• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

import packages?

 
Akhilesh Trivedi
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can import statement import a package or only classes?
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can import both packages as well as a specific class from a specific package

the general syntax is import <package-name>.*; //import all classes
//only classes are imported
//sub packages are not imported.
//you need to writes seperates statments if you want
//to import the sub packages to

import <package-name>.<class-name>; //import a class
 
Akhilesh Trivedi
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a mock test i had statement.
import <pacakgename> ;

with no dot star (.*) after it.
 
Purujit Saha
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Akhil Trivedi

import <pacakgename> ;

with no dot star (.*) after it.



This is error.
We can use import statement as,
1) import <pacakgename> . *;
2) import <pacakgename> . <classname>;
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic