Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

com

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi friends
i came across a question that says
import com.test.TEST;
where does the com directory/package come from
can any body help me on this???
sanjeev
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sanjeev,
You are probably looking at a program in a book or some published material. The author here is talking about a directory structure similar to \com\test\TEST
If you tell us more about the source of this question, may be we can help you better.
Also, I should remind you that PROPER NAMES ARE NOW REQUIRED!!Please Read the JavaRanch naming policy for more details.
Javaranch appreciates your cooperation to comply with the official naming policy.
Ajith

 
sanjeev s
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the question was that
import com.test.Test //no directory structure given
class test1
{
//some code
}
class Test
{
//some code here
}
will this code complie and run
i think the auther wants to ask weather you can
refer to Test class in com/test....
sanjeev
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
The Code will compile without error only if
1) You are having within your classpath the above mention package.
But if you donot have the above mention directory structor then it will give you a compilation error.
It is not what author what wants you to know but he wants you to know the.He basically want you to know how you two different programmers can provide same na to the packages.
Please see the JLS for the further information
7.7 Unique Package Names
Hope this will clear your doubt.
bye
take care
Sada
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic