Solved

Determining Interfaces implemented at Runtime

Posted on 1998-06-03
1
218 Views
Last Modified: 2010-04-16
Is there a way to determine at runtime what interfaces an object implements?
0
Comment
Question by:Renae
1 Comment
 
LVL 4

Accepted Solution

by:
evijay earned 50 total points
ID: 1222055
Suppose you want to determine interfaces implemented by some object o. Do the following

Class[] list = o.getClass().getInterfaces();
for (int i = 0; i < list.length; i++)
System.out.println(list[i].getName());

0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question