import java.lang.reflect.Method;
class Book{
private String title;
private int price;
public void setTitle(String title) {
this.title = title;
}
public void setPrice(int price) {
this.price = price;
}
public String getTitle() {
return this.title;
}
public int getPrice() {
return this.price;
}
}
public class Main {
public static void main(String[] args) {
try{
Class <?> cls = Class.forName("Book");
Book book = (Book) cls.newInstance();
Method setMethod = cls.getMethod("setTitle", String.class);
Method getMethod = cls.getMethod("getTitle");
setMethod.invoke(book,"java");
System.out.println(getMethod.invoke(book));
}catch (Exception e){}
}
}