Package details in Java

DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Package details in Java

  1. #1
    Join Date
    Jun 2006

    Package details in Java


    i have a sample program but does not have the library archives files yet which is to be in the JAR type. i would love if some1 can tell me what does the above package actually imports... izzit in package something like from folder to folder
    com\cosl\security\. then the armorcs.api, and the ".*" means all the files after it?


  2. #2
    Join Date
    Feb 2006
    Cologne - Germany
    the compiler just imports the classes used within the code.
    just says, that when you declare a class that it doesn't know, it should search in the whole package.
    import java.util.*;

    public class test{
    private Map map = new HashMap();

    here the compiler first doesn't know where to find Map and HashMap. But the import tells him to search within the package java.util.
    It's the same as writing
    import java.util.Map;
    import java.util.HashMap;

    the classes you import have their own imports, so if you use a class from an external jar, you can be shure, that class itself will import more of the appropriate package. thus you have to include the whole jar with your application.

  3. #3
    Join Date
    Jun 2006
    wow thx, i think i understands whats the ".*" works behind the syntax but i cant get the understand of how the "" works behind it?
    is it also function inside the armorcs or its a package? or folder combination?

    Thx dude

  4. #4
    Join Date
    Feb 2006
    Cologne - Germany
    "" is a package. packages usually are organized within folders. Thus the package "" denotes the folder structure "com/cosl/security".
    within that package / folders there are a lot of classes with lot's of code.
    packages exist for two purposes:
    1. to organize your code. so you can put classes that work together or have a logical common point into one package. example: mypackage.model, mypackage.view
    2. to allow the programmer to use classnames twice. in different packages there may be classes with the same name, but not in the same package. since every class file is represented by a file in a folder, there can't be two files with the same name in the same folder. but there may be in different folders.

  5. #5
    Join Date
    Jun 2006
    hmm ok, thx alot i think i understand it already

Similar Threads

  1. Replies: 0
    Last Post: 11-16-2005, 06:39 AM
  2. Java vs. .Net. A questionnaire
    By Basil in forum .NET
    Replies: 1
    Last Post: 05-13-2005, 07:46 AM
  3. DevX does seem one sideded
    By Rob Abbe in forum Talk to the Editors
    Replies: 44
    Last Post: 01-13-2003, 03:57 PM
  4. dropdown boxes
    By Matt in forum Web
    Replies: 5
    Last Post: 03-22-2001, 08:59 PM
  5. Re: VB vs. Visual Age for Java
    By JJ in forum Enterprise
    Replies: 1
    Last Post: 07-06-2000, 05:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center