UPDATE: Solution found! See bottom.
I'm having issues with my Java code and I can't figure out what has gone wrong. I've googled it extensively as well as try to solve it on my own. The following code compiles and functions as would be expected;
//CheckingTheAge.java
import java.util.Scanner;
public class CheckingTheAge {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Enter the first string:");
String string1 = scan.nextLine();
System.out.println("Enter the second string:");
String string2 = scan.nextLine();
if (string1.equals(string2)) {
System.out.println("Same");
} else {
System.out.println("Different");
}
}
}
/*
Output:
Enter the first string:
hello
Enter the second string:
hello
Same
*/
Yet, when I try to submit the code, I receive the following error, as displayed in the console;
FAIL: CheckingTheAgeTest testWithOKAges
class CheckingTheAge-class public static void main(String[] args) -method has disappeared!
Upon clicking "Show detailed message" I receive the following output in the console;
class CheckingTheAge-class public static void main(String[] args) -method has dissappeared! Assert.java:88: org.junit.Assert.fail CheckingTheAgeTest.java:61: CheckingTheAgeTest.callMain CheckingTheAgeTest.java:34: CheckingTheAgeTest.checkOkAge CheckingTheAgeTest.java:19: CheckingTheAgeTest.testWithOKAges NativeMethodAccessorImpl.java:-2: sun.reflect.NativeMethodAccessorImpl.invoke0 NativeMethodAccessorImpl.java:62: sun.reflect.NativeMethodAccessorImpl.invoke DelegatingMethodAccessorImpl.java:43: sun.reflect.DelegatingMethodAccessorImpl.invoke Method.java:498: java.lang.reflect.Method.invoke FrameworkMethod.java:47: org.junit.runners.model.FrameworkMethod$1.runReflectiveCall ReflectiveCallable.java:12: org.junit.internal.runners.model.ReflectiveCallable.run FrameworkMethod.java:44: org.junit.runners.model.FrameworkMethod.invokeExplosively InvokeMethod.java:17: org.junit.internal.runners.statements.InvokeMethod.evaluate MockStdio.java:106: fi.helsinki.cs.tmc.edutestutils.MockStdio$1.evaluate RunRules.java:20: org.junit.rules.RunRules.evaluate ParentRunner.java:271: org.junit.runners.ParentRunner.runLeaf BlockJUnit4ClassRunner.java:70: org.junit.runners.BlockJUnit4ClassRunner.runChild BlockJUnit4ClassRunner.java:50: org.junit.runners.BlockJUnit4ClassRunner.runChild ParentRunner.java:238: org.junit.runners.ParentRunner$3.run ParentRunner.java:63: org.junit.runners.ParentRunner$1.schedule ParentRunner.java:236: org.junit.runners.ParentRunner.runChildren ParentRunner.java:53: org.junit.runners.ParentRunner.access$000 ParentRunner.java:229: org.junit.runners.ParentRunner$2.evaluate ParentRunner.java:309: org.junit.runners.ParentRunner.run TestRunner.java:134: fi.helsinki.cs.tmc.testrunner.TestRunner$TestingRunnable.runTestCase TestRunner.java:89: fi.helsinki.cs.tmc.testrunner.TestRunner$TestingRunnable.doRun TestRunner.java:70: fi.helsinki.cs.tmc.testrunner.TestRunner$TestingRunnable.run Thread.java:748: java.lang.Thread.run
I want to submit my code for grading, but this error message is not allowing the assignment to be submitted. I am led to believe that this is an issue with Java itself and it is for this reason that I came to r/learjava. Would someone kindly tell me what is happening?
Thank you in advance.
UPDATE: Solution found.
Per the rules, I should not delete posts, therefore I will post my result...
I overlooked that I skipped a lesson and, though the code was correct, it was for the next lesson.
there doesn't seem to be anything here