The range of n is -100--100
If the conversion succeeds, print the good job and print wrong answer if it is unsuccessful;
ImportJava.util.*;ImportJava.security.*; Public classSolution { Public Static voidMain (string[] args) {donotterminate.forbidexit (); Try{Scanner in=NewScanner (system.in); intn =In . Nextint (); In.close (); //String s=???; Complete this line belowString s=integer.tostring (n);if(n = =Integer.parseint (s)) {System.out.println ("Good job"); } Else{System.out.println ("Wrong answer."); } } Catch(donotterminate.exittrappedexception e) {System.out.println ("Unsuccessful termination!!"); } }}//The following class would prevent you from terminating the code using exit (0)!classDonotterminate { Public Static classExittrappedexceptionextendsSecurityException {Private Static Final LongSerialversionuid = 1; } Public Static voidForbidexit () {FinalSecurityManager SecurityManager =NewSecurityManager () {@Override Public voidcheckpermission (Permission Permission) {if(Permission.getname (). Contains ("EXITVM")) { Throw Newexittrappedexception (); } } }; System.setsecuritymanager (SecurityManager); }}
The Java instance forces a reshape n into a string