Include Vs Import
There are two terms IMPORT and INCLUDE ,
In C and C++ Programs , Include Statement is used
#include directive makes the compiler go to the C/C++ standard library
It copy the code from the header files into the program.
The whole include file code will copy into the program
As a result, the program size increases
wasting memory and
processor’s time.
In Java Programs , Import Statement is used
import statement makes the JVM(Java Virtual Machine) go to the Java standard library,
execute the code there ,
and substitute the result into the program.
Hence, no code is copied
hence no waste of memory and
processor’s time.
Hence import is more efficient mechanism than #include.
By - Somesh Sah
Comments
Post a Comment