{"id":17771,"date":"2016-09-12T18:48:55","date_gmt":"2016-09-12T18:48:55","guid":{"rendered":"http:\/\/www.oracletutoring.ca\/blog\/?p=17771"},"modified":"2016-09-12T18:48:55","modified_gmt":"2016-09-12T18:48:55","slug":"java-the-meaning-of-used-with-import","status":"publish","type":"post","link":"https:\/\/www.oracletutoring.ca\/blog\/java-the-meaning-of-used-with-import\/","title":{"rendered":"Java:  the meaning of * used with import"},"content":{"rendered":"<h1>The tutor offers an interpretation of what the asterisk (aka, wildcard) means in an import statement.<\/h1>\n<p>I&#8217;m not trained in Java, but do write experimental programs with it.  Here are some ideas about the import statement, as I understand it:<\/p>\n<p>Herein, it might be helpful to think of a <em>package<\/em> as a <em>directory<\/em>.<\/p>\n<p>The Java statement<\/p>\n<p><span style=\"font-family:monospace\">import pckg0.member0;<\/span><\/p>\n<p>gives access to the definition of <span style=\"font-family:monospace\">member0<\/span>, as needed for the program.  In this context, <span style=\"font-family:monospace\">member0<\/span> is a single, specific <em>class<\/em> found in the <em>package<\/em> <span style=\"font-family:monospace\">pckg0.<\/span><\/p>\n<p>The statement<\/p>\n<p><span style=\"font-family:monospace\">import pckg0.*;<\/span><\/p>\n<p>gives access to all &#8220;single&#8221; classes contained in <span style=\"font-family:monospace\">pckg0<\/span>, but not to those of its subdirectories.  If <span style=\"font-family:monospace\">pckg0<\/span> contains the package <span style=\"font-family:monospace\">pckg00<\/span>, which contains the class <span style=\"font-family:monospace\">mem01<\/span>, then the statement<\/p>\n<p><span style=\"font-family:monospace\">import pckg0.pckg00.mem01;<\/span><\/p>\n<p>provides access to it.<\/p>\n<p>The statement<\/p>\n<p><span style=\"font-family:monospace\">import pckg0.pckg00.*;<\/span><\/p>\n<p>provides access to all single classes in <span style=\"font-family:monospace\">pckg00<\/span>.<\/p>\n<p>Therefore, the two import statements, one atop the other,<\/p>\n<p><span style=\"font-family:monospace\">import pckg0.*;<\/span><br \/>\n<span style=\"font-family:monospace\">import pckg0.pck00.*;<\/span><\/p>\n<p>can sensibly occur together at the top of a Java program.<\/p>\n<p>HTH:)<\/p>\n<p>Source:<\/p>\n<p>McGrath, Mike.  <u>Java in Easy Steps<\/u>, 5th ed.  Warwickshire:  Easy Steps Limited, 2014.<\/p>\n<p><a href=\"https:\/\/docs.oracle.com\/javase\/tutorial\/java\/package\/usepkgs.html\">docs.oracle.com<\/a><\/p>\n<p>Jack of <a href=\"https:\/\/www.oracletutoring.ca\">Oracle Tutoring by Jack and Diane,<\/a> Campbell River, BC.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The tutor offers an interpretation of what the asterisk (aka, wildcard) means in an import statement. I&#8217;m not trained in Java, but do write experimental programs with it. Here are some ideas about the import statement, as I understand it: &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.oracletutoring.ca\/blog\/java-the-meaning-of-used-with-import\/\"> <span class=\"screen-reader-text\">Java:  the meaning of * used with import<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[105,1801],"tags":[1880,1879],"class_list":["post-17771","post","type-post","status-publish","format-standard","hentry","category-computer-science","category-java","tag-asterisk-with-import-statement","tag-wildcard-with-import-statement"],"_links":{"self":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/17771","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/comments?post=17771"}],"version-history":[{"count":14,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/17771\/revisions"}],"predecessor-version":[{"id":17785,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/17771\/revisions\/17785"}],"wp:attachment":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/media?parent=17771"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/categories?post=17771"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/tags?post=17771"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}