Closed. This question needs details or clarity。它当前不接受答案。
                            
                        
                    
                
                            
                                
                
                        
                            
                        
                    
                        
                            想改善这个问题吗?添加详细信息并通过editing this post阐明问题。
                        
                        5年前关闭。
                                                                                            
                
        
如何从字符串中调用类?
例如。

String choice;
System.out.print("Enter your movie name:")
String=sc.nextString();

if(String=="MyMovie")
{


我可以用吗:

choice.main(null);
}

最佳答案

试试这个代码。

String choice;
System.out.print("Enter your movie name:")
choice = sc.nextString();
if(choice.equals("MyMovie")) {
    //do something but not choice.main(null)
}

08-05 10:58