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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:37:45+00:00 2026-05-25T18:37:45+00:00

I want to write a java program to print all (public or private) parameters

  • 0

I want to write a java program to print all (public or private) parameters of a class and their types. I think I have to use reflection, but I’m noob at java reflection.

As an example, I need the my program to run on below class and result in following output:

class a{
    public int b;
    public int c;
    private String s;    
}

output:

b: int
c: int
s: St

Finally my question is how to get a list of parameters of a class and their types.

  • 1 1 Answer
  • 1 View
  • 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-25T18:37:45+00:00Added an answer on May 25, 2026 at 6:37 pm

    I would recommend you explore the javadoc, starting with the Class class:

    Instances of the class Class represent classes and interfaces in a running Java application.

    Of note is the method getDeclaredFields(), which returns an array of Field objects representing the fields the class declares.

    Also take note of the ways to obtain a Class object:

    Class<MyClass> c = MyClass.class; //statically
    
    MyClass mc = new MyClass();
    Class<? extends MyClass> c2 = mc.getClass(); //dynamically
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

HI I want to write a java program by which I can delete all
I have a dummy Java Program, which I want to write in Clojure. It
I want to write a java program that acts as a user interface to
Hi I want to write a java program where I will provide my email
I want to write a Java program that'll access a few web pages that
I want to write ajax code in java i.e. i want use the functionality
I want to write a simple visualization of a Java program by displaying the
Hi i want my java program to show a popup and gain read,write,delete file,folder
I have a Java program that loads thirdparty class files (classes I did not
Im trying to write a java program using xml dom. i just want to

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.