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 6720267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:11:32+00:00 2026-05-26T09:11:32+00:00

Is it possible to specify a method as a method parameter? e.g. public void

  • 0

Is it possible to specify a method as a method parameter?

e.g.

public void someMethod(String blah, int number, method MethodName)

Where MethodName is the name of a different method that needs to be specified.

Thanks

  • 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-05-26T09:11:33+00:00Added an answer on May 26, 2026 at 9:11 am

    No, but you specify an interface with a single method. And you can pass an anonymous implementation to the method

    interface CompareOp {
      int compare(Object o1, Object o2);
    }
    
    // Inside some class, call it Klass
    public static int compare ( CompareOp comparator, Object o1, Object o2) {
       return comparator.compare(o1, o2);
    }
    

    Then you would call it like

    Klass.compare( new CompareOp(){
      public int compare(Object o1, Object o2) {
        return o1.hashCode() - o2.hashCode();
      }
    }, obj1, obj2 );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose you have a method with the following signature: public void SomeMethod(bool foo =
Is it possible to specify a method block parameter in Objective-C without using a
Is it possible to specify a Java classpath that includes a JAR file contained
Is it possible to specify a relative connection string for an AzMan XML store?
Is it possible to specify that members of a nested class can be accessed
Is it possible to specify the time zone that log4j will use? I need
I have a method where I want to have a parameter that is a
Ok, this is what I want to do: public static void CallStaticMethod(Type myType, String
Is it possible to specify a color in a properties file that has an
Is it possible to specify my own default object instead of it being null?

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.