wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Which is a better practise and why? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Which is a better practise and why?" Watch "Which is a better practise and why?" New topic
Author

Which is a better practise and why?

kshitij kaushik
Greenhorn

Joined: Jan 14, 2009
Posts: 11
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.....


thanx
kshitij
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

SUN recommends "class per file", For more details, look here !


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

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


Dear kshitij , what do you mean ?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19654
    
  18

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
kshitij kaushik
Greenhorn

Joined: Jan 14, 2009
Posts: 11
okey.....Thanks a lot guys for giving your precious time for my query.....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Which is a better practise and why?
 
Similar Threads
Rufus:Who is tech writer?
from Khalid 's book
Ant vs Maven
veriables in Java Bean
What is the advantage of Arithmetic Assignment Operators like += over normal arithmetic operator?