What is the difference between importing a classand creating the object for that class

Showing Answers 1 - 2 of 2 Answers

Sumit Malik

  • Jun 1st, 2006
 

Hi Anurag, If there is any class another then in java.lang package(which get imported by default) then we need to import that class. When import statement get comiled by compiler(JVM) then that class get loaded into memory.Once class get loaded into memory then we can make an object of that Class.By using new keyword we explicity create object of that class and perform any operation as per the requirement.All this done at runtime.I hope i have clarified your doubts Anurag.I would love to see comment from other fellow of portal.Thanks,Sumit Maliksumit.mk@gmail.com

  Was this answer useful?  Yes

Jue George

  • Sep 14th, 2006
 

While we import a class, we can use only the static methods in that class. Unless until we instantiate a class using new keyword , we cant call the public methods defined in that class ..

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions