MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / speak

Method speak

staticchecking/latent/Latent.java:30–47  ·  view source on GitHub ↗
(Object speaker)

Source from the content-addressed store, hash-verified

28
29class Communicate {
30 public static void speak(Object speaker) {
31 try {
32 Class<? extends Object> spkr =
33 speaker.getClass();
34 Method talk =
35 spkr.getMethod("talk", (Class[])null);
36 talk.invoke(speaker, new Object[]{});
37 } catch(NoSuchMethodException e) {
38 System.out.println(
39 speaker + " cannot talk");
40 } catch(IllegalAccessException e) {
41 System.out.println(
42 speaker + " IllegalAccessException");
43 } catch(InvocationTargetException e) {
44 System.out.println(
45 speaker + " InvocationTargetException");
46 }
47 }
48}
49
50public class Latent {

Callers 1

mainMethod · 0.95

Calls 1

invokeMethod · 0.45

Tested by

no test coverage detected