• Post Reply Bookmark Topic Watch Topic
  • New Topic

Which is a better practise and why?  RSS feed

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which is a better practice and why? Writing whole source code in a single java file or writing individual java files for each class or mix of both.....
please answer.....
 
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SUN recommends "class per file", For more details, look here !
 
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

kshitij kaushik wrote:whole source code in a single java file



Dear kshitij , what do you mean ?
 
Sheriff
Posts: 21291
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think he means this:

All in the same file, with at most one of the classes public.


Except for little test cases, I would really discourage this approach. With each class in its own file, there is a better overview of where you can find each class. If everything is in one file you have to do a search first.
 
kshitij kaushik
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okey.....Thanks a lot guys for giving your precious time for my query.....
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!