Otomeram Otomeram - 1 month ago 6
Java Question

I'm new at programming. I'm not sure how much to use methods

So, I just finished my first program, but I haven't use any methods in it, since I'm just beginning to learn how to use them. Here's the original code : http://codepad.org/JiBfJI8Q I started to fractionate it but realised that it would be a method inside another all the way down. Is that actually the way to do it, or did I get the idea wrong?

Answer

without having looked at your code:
The general idea of methods is to separate small portions of code which might be used at multiple other places in your code.

so yes, calling methods from within other methods is a good thing to do.
ideally your so called "composed methods" read out like a little story:

public void transaction(){
   openDatabaseConnection();
   addRecordsToDatabase();
   closeDataseConnection();
}