• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

i am in cofusion

 
ranjan sarkar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public class name{
......}

in this program if we save it by name11.java then it won't works properly that is
if we change the class name with the file name.

yet in case of
class name{.......}
it will run even if the class name is different it works properly.

so please clear this concept.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by RANJAN SARKAR:
public class name{
......}

in this program if we save it by name11.java then it won't works properly that is
if we change the class name with the file name.

yet in case of
class name{.......}
it will run even if the class name is different it works properly.



Now i am in confusion

note:
--------------------------------
please give meaningful subjectline
---------------------------------
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All public classes have to be in a file with the same name as the class. Classes with other access specifiers can be saved in a file of any name.
[ August 05, 2008: Message edited by: Joanne Neal ]
 
ranjan sarkar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to know why all public classes have to be in a same file.
But not for the other class specifiers
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I would like to know why all public classes have to be in a same file

Because those are the rules.
[ August 05, 2008: Message edited by: Paul Sturrock ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic