I have a class say ClassOne.
The ClassOne has two methods say method1() and method2() and both of these methods are static and will be called right one after other(like this):
ClassOne.method1();
ClassOne.method2();
This sequence is guaranteed not to change.
Now I wanted to know if there is any performance difference in the above case and the following case:
Second Case:
method1(){
method2();
}
In terms of performance, making the method calls in either way would produce the same bytecode and does not offer any performance benefits.
Have a look at this article for a better understanding
http://www.codeproject.com/Articles/30422/How-the-Java-Virtual-Machine-JVM-Works
In terms of which style to use, it depends on what function each of the method performs. If method1() relies on the task performed by method2(), then you couple it iside, but if it doesn’t, and method2() does something which needs to be performed after method1() finishes then you keep them separate to maintain the separation of concerns.