JAVA Syllabus

What is the difference between '#include' and 'Import' statement?

The '#include' directive makes the compiler go to the C/C++ standard library and copy the code from the header files into the program. As a result, the program size increases, thus wasting memory and processor time.

The 'import' statement makes the JVM go to the JAVA standard library, execute the code there, and substitute the result into the program. Here, no code is copied, and hence no waste of memory or processor time. So 'import' is an efficient mechanism than '#include'.

02/03/2023, 11:37 am Read : 119 times