fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. interface IMotor extends ICambio {
  8. public void SetMotor(String v);
  9. }
  10. interface ICambio {
  11. public void SetCambio(String v);
  12. }
  13. interface IRobo {
  14.  
  15. }
  16. class Car implements IMotor, IRobo{
  17.  
  18. /**
  19.   * @return the id
  20.   */
  21. public Integer getId() {
  22. return id;
  23. }
  24.  
  25. /**
  26.   * @param id the id to set
  27.   */
  28. public void setId(Integer id) {
  29. this.id = id;
  30. }
  31.  
  32. /**
  33.   * @return the description
  34.   */
  35. public String getDescription() {
  36. return description;
  37. }
  38.  
  39. /**
  40.   * @param description the description to set
  41.   */
  42. public void setDescription(String description) {
  43. this.description = description;
  44. }
  45. private Integer id;
  46. private String description;
  47.  
  48. @Override
  49. public void SetMotor(String v) {
  50. throw new UnsupportedOperationException("Not supported yet.");
  51. }
  52.  
  53. @Override
  54. public void SetCambio(String v) {
  55. throw new UnsupportedOperationException("Not supported yet.");
  56. }
  57. }
  58.  
  59. class Ideone
  60. {
  61. public static void main (String[] args) throws java.lang.Exception
  62. {
  63. Car car = new Car();
  64. Class<?>[] interfaces = car.getClass().getInterfaces();
  65. ArrayList<String> items = new ArrayList<>();
  66. SetInterfaces(interfaces, items)
  67. .forEach((item) -> {
  68. System.out.println(item);
  69. });
  70. }
  71. public static ArrayList<String> SetInterfaces(Class<?>[] interfaces, ArrayList<String> items)
  72. {
  73. for (Class<?> intf : interfaces) {
  74. items.add(intf.getName());
  75. SetInterfaces(intf.getInterfaces(), items);
  76. }
  77. return items;
  78. }
  79. }
Success #stdin #stdout 0.06s 33552KB
stdin
Standard input is empty
stdout
IMotor
ICambio
IRobo