Closed rlniranjan9 closed 5 years ago
Which question/problem are you referring to?
all
On Thu, Mar 28, 2019 at 5:14 AM Rodney Shaghoulian notifications@github.com wrote:
Which question/problem are you referring to?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RodneyShag/HackerRank_solutions/issues/14#issuecomment-477388639, or mute the thread https://github.com/notifications/unsubscribe-auth/AtcqqNu1LSF5VUwE8owkAOrdWnoq5_qkks5vbAJ4gaJpZM4cNgo2 .
Please make sure you are using Java 8 when submitting solutions. Also, HackerRank has changed many of the 300 problems I've solved, so sometimes you may have to change my solution slightly to get it to work with HackerRank's updated problem. Or, open an issue with a specific solution that doesn't work and I will fix it. Thanks.
Hi rodney, where should i paste the code. the following code cannot be changed , i need to insert the code in between, please help how and what to paste import java.util.; import java.security.; public class Solution { public static void main(String[] args) {
DoNotTerminate.forbidExit();
try { Scanner in = new Scanner(System.in); int n = in .nextInt(); in.close(); //String s=???; Complete this line below
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 will prevent you from terminating the code using exit(0)! class DoNotTerminate {
public static class ExitTrappedException extends SecurityException {
private static final long serialVersionUID = 1; }
public static void forbidExit() { final SecurityManager securityManager = new SecurityManager() { @Override public void checkPermission(Permission permission) { if (permission.getName().contains("exitVM")) { throw new ExitTrappedException(); } } }; System.setSecurityManager(securityManager); } } Regards, lokesh
On Thu, Mar 28, 2019 at 10:47 AM Rodney Shaghoulian < notifications@github.com> wrote:
Closed #14 https://github.com/RodneyShag/HackerRank_solutions/issues/14.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RodneyShag/HackerRank_solutions/issues/14#event-2235145559, or mute the thread https://github.com/notifications/unsubscribe-auth/AtcqqHn3QAjqoQBYxj6krlsLk7dpYluiks5vbEidgaJpZM4cNgo2 .
Hi. I'm guessing you're referring to the "Java Int to String" problem. I've updated the solution to just the part you need to copy/paste, which is: String s = "" + n;
Compiler Message Wrong Answer Input (stdin)Download INPUT Expected OutputDownload Stuart Kristeen Christene Amina Aamina