Difference between #include in C/C++ and import in JAVA Last Updated : 14 Jan, 2021 Comments Improve Suggest changes Like Article Like Report #include in C/C++: In the case of C language, #include is a standard or user-defined file in a program that tells the preprocessor to insert the internal contents of another file into the source code of the program. Syntax: #include<stdio.h> Program 1:Below is a C Program to demonstrate the use of #include: C // C Program to demonstrate use of #include #include <stdio.h> // Header file loads all the // necessary Input output // file at beginning only // Driver Code int main() { printf("GeeksforGeeks"); return 0; } Output: GeeksforGeeks import in Java: In JAVA, the import statement is used to load the entire package or some classes in a package. It is written before the definition of the class and after the package statement(if present). Syntax: import java.util.*; Program 2:Below is a Java program to demonstrate the use of the import statement: Java // Java program to demonstrate use of import import java.io.*; // import statement doesn't load // all the necessary files at // beginning rather it loads // only those files which it // needs at the runtime class GFG { public static void main(String[] args) { System.out.println("GeeksforGeeks"); } } Output: GeeksforGeeks Both #include in C/C++ and import in Java is used to load predefined header files or packages but there are certain differences which are listed below: S No. #include in C/C++ import in Java 1It is mandatory to use the #include statement to include standard header files.Import statement in java is optional2It loads the file at the beginning only. No class files will be loaded at the beginning. Whenever a particular class is used then only the corresponding class file will be loaded.3Unnecessary waste of memory and processor's time.No such waste of memory and processor's time.4Size of the program increases. No increase in the size of the program.5It is also called as static include.It is also called as dynamic include. Comment More infoAdvertise with us Next Article Difference between #include in C/C++ and import in JAVA D deepakkumar737373 Follow Improve Article Tags : Misc Java C++ Programs Difference Between Programming Language C++ CPP-Basics java-basics +4 More Practice Tags : CPPJavaMisc Similar Reads Difference Between .cc and .cpp File Extensions in C++ In C++, we use different file extensions to store our code. Two of the most common extensions are .cc and .cpp both store C++ codes. Although they both are used for the same purpose yet there are some differences between them. In this article, we will learn the key differences between the .cc and .c 2 min read Difference Between gcc and g++ The GNU Compiler Collection, abbreviated as GCC provides multiple compilers to compile source codes of different programming languages, mainly C and C++. In its command line interface, it provides two commands "gcc" and "g++" which are used to invoke the compiler to compile the given source code to 3 min read Can I Mix C and C++ Code in the Same Project? C and C++ both are very popular programming languages. There can be many situations when you might have to export some functionalities that are written in C programming language into your C++ code. Now the biggest question arises while making any project in C and C++ is that- "Can we Mix C and C++ C 3 min read How Do I Use 'extern' to Share Variables Between Source Files? In C++, extern is a keyword that helps in sharing variables, and functions declared in one file to all the other files. In this article, we will learn how we can use the extern keyword to share variables between source files in C++. How to Use Extern Keyword in C++The extern keyword in C++ extends t 2 min read Creating a C++ reusable Header File and its Implementation Files Reusability is one of the most important concepts of Software Engineering. Reusability means developing code that can be reused either in the same program or in different programs. C++ allows reusability through inheritance, containership, polymorphism, and genericity. But, there is another way to d 4 min read Like