Results 1 to 4 of 4

Thread: File name

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    3

    File name

    can someone pls tell me why we always have to save the prog file with the same name as the main class.if i don't i get a strange error message.

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: File name

    What is the "prog file"?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3
    Lively Member
    Join Date
    Dec 2005
    Posts
    68

    Re: File name

    I think he means why do you have to save the class in a file with the same name.

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: File name

    Because of Java's class lookup rules. Java computes the name of the file storing a class from the class name. That's the short version. For the long version, search this forum for posts by me containing "classpath" and "class loader", or browse the web.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width