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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:19:13+00:00 2026-05-25T03:19:13+00:00

My class A has AClaz[] rofl; The documentation for getDeclaredFields says This method returns

  • 0

My class A has

   AClaz[] rofl;

The documentation for getDeclaredFields says “This method returns an array of length 0 if the class or interface declares no fields, or if this Class object represents a primitive type, an array class, or void. ”

I want to access the rofl array of type AClaz using reflection. Even if the AClaz is an inner class of class A.

So I would do getDeclaredClass ?

  • 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-25T03:19:13+00:00Added an answer on May 25, 2026 at 3:19 am

    You’re misreading the documentation – it’s talking about calling getDeclaredFields on an array class, like this:

    Class<?> arrayClass = String[].getClass();
    Field[] fields = arrayClass.getDeclaredFields();
    

    You should be able to get the field from A without any problem using

    Field[] fields = A.class.getDeclaredFields();
    

    and then iterate over the array, or

    Field roflField = A.class.getDeclaredField("rofl");
    

    The fact that the field type is an array is not a problem at all.

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

Sidebar

Related Questions

My Address class has a geocode class method that returns an array of address
The Type class has a method IsAssignableFrom() that almost works. Unfortunately it only returns
Thread class has run method to implement the business logic that could be executed
My AppDelegate_Phone class has the method -(void)doSomething . How can I call that from
Like so : a class has a method called sayHello() . When a instance
Suppose a class has a method that modifies it's internals. Should that method call
The Convert class has been in existence since .NET 1.0. The IConvertible interface has
The generic list class has a .ForEach(Action<T> action) method. Now i've done some simple
Python's datetime class has a fromtimestamp method to create a datetime object from a
The PropertyInfo class has the GetValue method which takes two parameters, the first one

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.