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

  • SEARCH
  • Home
  • 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 9145177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:26:58+00:00 2026-06-17T10:26:58+00:00

Well. I am new to Java. I know that main needs to be static

  • 0

Well. I am new to Java. I know that main needs to be static method. But I have read that an static method can call only other static methods ? Then how come we can call non-static methods ? Its a confusion rather than a question. For example

 public class Function
    {
    public static int side = 10,area,vol;

    public static void main(String args[])
    {
        System.out.println("programme to find area and volume");
        Function fu = new Function();
        fu.calarea();
    }
    public void calarea()
    {
        area = side*side;
        System.out.println("finished calculating area now calling volume");
        calvol();
    }
    public void calvol()
    {
        vol = area*side;
        System.out.println("finished calculating volume now calling display");
        display();
    }
    public void display()
    {
        System.out.println("side of a square ==>"+side);
        System.out.println("area of a square ==>"+area);
        System.out.println("volume of a square ==>"+vol);
    }
    }

In here, main() is a static method. So, it must call static methods only ? How come, it can call calarea() ? If I am right by creating a object ??

EDIT:

I had thought the same. And I know how to call static methods. I only want to know that if it is possible to call non-static methods(by any means), then why it is said that an static method can call only other static methods ?

  • 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-17T10:27:00+00:00Added an answer on June 17, 2026 at 10:27 am

    But I have read that an static method can call only other static methods ?

    That is either a misstatement or a misreading.

    A more correct statement of the “rule” is that a static method cannot call instance methods without a specific (non-null) instance reference. Or to put it another way, this is not valid in a static method, so it cannot be used explicitly or implicitly to make method calls.

    Your example doesn’t break the rule … in either form. It is using an non-null object reference, and it is not using this explicitly or implicitly.


    Most of the other subquestions are “mooted” by the above but …

    If I am right by creating a object ??

    Yes. It is necessary to create the object in order to have an object reference that you can use to call the instance method. There is no other way to call an instance method.

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

Sidebar

Related Questions

I was wondering how can I make a scanner in java that will read
I'm quite new to Java and am stuck with this, please. Well I know
i'm learning c++. i know quite well java and python, but i'm getting mad
hi I am new here and new in Java programming as well actually my
Well I'm new to PHP but thinking about these stuff has really confused me
Well, I'm completely new to JavaScript. Can you please tell me what type of
Starting a new rails project and we have a well-thought-out color palette, and want
I know. Heresy. But I'm in a bind. I have a lot of config
Well this code works fine in java but when i started to run it
I'll preface this by stating that I know Java is not JavaScript and vice

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.