I observed that many programmers do not create separate functions.
They write the whole program in the main function.
Doesn't this reduce its modularity?
eg:
class abc
{
public static void main(String args[])
{
int a=10;
System.out.println(++a);
}
}
it could also be written as:-
class abc
{
private int a=10;
public void calc()
{
System.out.println(++a);
}
public static void main(String args[])
{
abc a1=new abc();
a1.calc();
}
}
I do not understand the reason to why this is done.
the eg given is of a small program but if it was a big one then according to me there wold be a problem in handling the first program.
Please explain me.