w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Java Class.forName won't compile. Getting "cannot find symbol symbol : method"

If theResponse() belongs to http.response.PublicRoute then it should have been

Class c = Class.forName("http.response.PublicRoute");
return ((PublicRoute) c.newInstance()).theResponse("hi");

But, then there's really no need for Class.forName() as you could use constructor as

return new PublicRoute().theResponse("hi");

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.