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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:54:18+00:00 2026-05-15T09:54:18+00:00

Here is a sample code package org.example; import java.lang.reflect.Method; class TestRef { public void

  • 0

Here is a sample code

package org.example;

import java.lang.reflect.Method;

class TestRef {

        public void testA(String ... a) {
                for (String i : a) {
                        System.out.println(i);
                }
        }

        public static void main(String[] args){

                Class testRefClass = TestRef.class;

                for (Method m: testRefClass.getMethods()) {
                        if (m.getName() == "testA") {
                                System.out.println(m);
                        }
                }
        }
}

The output is

public void org.example.TestRef.testA(java.lang.String[])

So the signature of the method is reported to take a array of String.

Is there any mean in the reflection library I can tell that the method is originally declared to take a varargs?

  • 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-15T09:54:18+00:00Added an answer on May 15, 2026 at 9:54 am

    Is there any mean in the reflection library I can tell that the method is originally declared to take a varargs?

    Yup. java.lang.reflect.Method.isVarArgs().

    However, this is only of use if you are trying to assemble and display method signatures in human readable form. If you need to invoke a varargs method using reflection, you will have to assemble the varargs arguments into an array-typed argument.

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

Sidebar

Ask A Question

Stats

  • Questions 516k
  • Answers 516k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It should be (note the apostrophes): <div onmouseover="addHeading(document.body, 'Header added')">… May 16, 2026 at 6:42 pm
  • Editorial Team
    Editorial Team added an answer Pizza, which was sort of a predecessor for Scala had… May 16, 2026 at 6:42 pm
  • Editorial Team
    Editorial Team added an answer Yes, you should give the <body> a min-width. Just a… May 16, 2026 at 6:42 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm using drscheme from: http://www.archlinux.org/packages/extra/x86_64/drscheme/ I'm trying to work with the sample code in
Why doesn't ICloneable 's Clone method return a deep copy? Here is some sample
I'm totally new to both java and java Server worlds... But I've a good
I am new to Java and I am attempting to use JDBC to connect
Good evening everyone! I am working on learning some java and I have made
*** sweet - thanks to Edward Smith for the CF Technote that indicated the
I need to get the mjpeg stream from an IP camera, anyone know the
I was doing simple things with hibernate, as I have to learn it for
I am following the MasteringEJB4thEdition book, which I downloaded from The Server Site website.
Has any been able to successfully run with a client using the WSO2/C++ web

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.