Simple Java Question

Discussion in 'Programming' started by homemadejam, Jul 11, 2009.

  1. #1
    Hey everyone,

    I am currently working on a little Java assignment for Uni, and I am unsure of what this part means:

    Once the Data.class file is in the same directory as your program, the arrays can be referenced directly - almost as if they were in your program file. (e.g. the info array would normally be referenced as info, should now be referenced as Data.info. Thus info[2][3] will be referenced as Data.info[2][3].)

    Alternatively, as Data is an Interface, it may be implemented and all arrays referenced directly.


    Could someone please explain this a little more to me?
    Thankyou in advice
     
    Solved! View solution.
    homemadejam, Jul 11, 2009 IP
  2. garrettheel

    garrettheel Peon

    Messages:
    341
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Look up java interfaces, it's laid out like a class but it's sort of like a strict set of rules that you can force classes to follow.
     
    garrettheel, Jul 12, 2009 IP
  3. #3
    they are saying that if you have made a class or you are using an existing class (compiled java file) you can use it in your main java file or in any other java file you want. but it has to be in the same dir else it does not work like that.

    you can use any method or data out of the class file by calling it like this:
    ClassName.Data; or ClassName.Method(); etc.

    hope you get it now.
     
    babynl, Jul 12, 2009 IP