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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:01:08+00:00 2026-06-08T04:01:08+00:00

Reflexion API shows that any Java array class implements interface java.lang.Cloneable and java.io.Serializable. It

  • 0

Reflexion API shows that any Java array class implements interface java.lang.Cloneable and java.io.Serializable. It does not have any member declared.

My questions are:

  • Where this ‘length’ is defined?

  • Where the protected Object clone() is overridden with public access
    specifier using co-variant return type(byte[] replacing Object) as we
    can directly assign it to a byte[]?

  • Where the association(IS-A) with Cloneable and Serializable is
    defined?

Also access specifier for the byte[] class contains “abstract final” which is not a legal combination of any class or method in Java.

    import java.lang.reflect.*;

    public class ArrayExplorer {

      public static void main(String[] args) {
      explore("Current class:", byte[].class);

      byte[] bytes = { 65, 'A' };
      System.out.println(bytes.length);

      byte[] cloned = bytes.clone();
      System.out.println(cloned);

   }

private static void explore(String msg, Class<?> class1) {
    if (class1 == null)
        return;

    System.out.println("**************************************\n" + msg
            + Modifier.toString(class1.getModifiers()) + " " + class1);

    // if (class1 == Object.class)
    // return;
    Field[] fields = class1.getDeclaredFields();
    for (Field field : fields) {
        System.out.println(field);
    }

    Method[] methods = class1.getDeclaredMethods();
    for (Method method : methods) {
        System.out.println(method);
    }

    explore("Superclass:", class1.getSuperclass());
    explore("Classes:", class1.getClasses());
    explore("ComponentType:", class1.getComponentType());
    explore("DeclaredClasses:", class1.getDeclaredClasses());
    explore("DeclaringClass:", class1.getDeclaringClass());
    explore("EnclosingClass:", class1.getEnclosingClass());

    if (!class1.isInterface()) {
        explore("Interfaces:", class1.getInterfaces());
    }

}

private static void explore(String msg, Class<?>[] classes) {
    if (classes == null || classes.length == 0)
        return;
    System.out.println(msg);
    for (Class<?> class1 : classes) {
        explore("", class1);
    }
    }
  }
  • 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-08T04:01:09+00:00Added an answer on June 8, 2026 at 4:01 am

    JavaDoc

    getDeclaredMethods
    

    Returns an array of Field objects reflecting all the fields declared by the class or interface represented by this Class object. This includes public, protected, default (package) access, and private fields, but excludes inherited fields. The elements in the array returned are not sorted and are not in any particular order. 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.

    getDeclaredMethods
    

    Returns an array of Field objects reflecting all the fields declared by the class or interface represented by this Class object. This includes public, protected, default (package) access, and private fields, but excludes inherited fields. The elements in the array returned are not sorted and are not in any particular order. 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.

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

Sidebar

Related Questions

Java's reflection API is obviously a very powerful tool, but not particularly object-oriented. What
I am playing with Java's reflection API, and I'm writing methods that inspect a
Is there any standard way to access Java Bean Property like class A {
I have basic knowledge of Java's reflection API - therefore, this is not only
If I use magic methods. While using reflection API, I can't investigate class properties..
During the last years I always thought that in Java, Reflection is widely used
I want to access a static JavaFX class member from Java using the Javafx
I've been working on an API that encapsulates another, trickier-to-use API. The goal is
Is there any reason why .NET's Reflection API uses arrays instead of indexers to
I'm playing around with Java's reflection API and trying to handle some fields. Now

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.