What's the difference between the meaning of import statement in Python and Java? -


I am a Python programmer and I am just starting to learn Java. I know that both Python and Java use import to get codes from other files. Is there any difference between the exact meaning of these imports in these 2 languages?

Java import refers to a brief reference that for classes it is different from some other languages. For example, in Python, the import keyword imports into a script's namespace. In Java, the import keyword only allows typing to reference types without specifying the full name.

In Python

 In  [1]: import os.path In [2]: Path ---------------- ----------------------------- --------------------- --------- NameError traceback (most recent call final) & lt; Ipython-input-2-e7fa32cb05ba & gt; In & lt; Module & gt; () ---- & gt; 1 Path Name: Error: Name 'path' is not defined [3]: os.path out [3]: & lt; From module 'posixpath' '/usr/lib/python2.7/posixpath.pyc'>   

You can not just specify the path using the "path", then you have to use "os.path"

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -