import - java imported resource names -


i'm new realm of programming has written need, , job bundle under simple class calls other person's functions, , typical uses of import strike me extremely odd.

as example, i'm using open-source spell checking jar called jazzy-core.jar. why type

import com.swabunga.spell.engine.spelldictionaryhashmap; 

to use piece of jar? expecting more like

import jazzy-core.spelldictionaryhashmap; 

or just

import jazzy-core; 

why of words (com, swabunga, etc) necessary, mean, , why none of them "jazzy"?

because import doesn't mean include jar in application. jar file have different name , therefore specifying jar file's name in import statement wouldn't feasible. instead import allows reference spelldictionaryhashmap without specifying qualified name. can write stuff like

spelldictionaryhashmap map = new spelldictionaryhashmap(); 

instead of

com.swabunga.spell.engine.spelldictionaryhashmap map = new com.swabunga.spell.engine.spelldictionaryhashmap(); 

classes , interfaces in java organized in packages (which have nothing jar files) , particular class in package com.swabunga.spell.engine.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -