Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9166315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:07:27+00:00 2026-06-17T15:07:27+00:00

I have a class say ClassOne . The ClassOne has two methods say method1()

  • 0

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();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:07:29+00:00Added an answer on June 17, 2026 at 3:07 pm

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class (say Product) with a property (say product_id) and has methods
Lets say I have Class A, that calls static methods in either Class B
Lets say I have: class Zebra{ public static function action(){ print 'I was called
I have a custom class say 'MyCanvas' derived from wpf Canvas class. MyCanvas has
say I have: class Test { public static int Hello = 5; } This
Pseudo-situation: have a class (let's say BackgroundMagic ), and it has Start() and Stop()
I have a class (say called Account) saved a as a variable (say cur_class)
I have created a class say A which has some functions defined as protected.
I have a class say: ClassA which has a collection of ClassB @OneToMany(cascade =
i have a class say A that has a protected method say methodA(), then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.