Java – use the console to read system. Java for IntelliJ in
•
Java
I need to open the console and use IntelliJ to enter my homework
Is there any way to do this? My code is as follows:
public class BasicAssertions {
@Test
public void testAssertions(){
System.out.println("Enter: ");
Scanner reader = new Scanner(system.in);
int first = reader.nextInt();
int second = reader.nextInt();
String s = reader.next();
String s2 = reader.next();
assertTrue(first<=second);
assertFalse(first+second >100);
assertNotEquals(s,s2);
assertNotNull(s2);
}
}
Solution
solve. To make the correct console appear, you need to use the public static void main() method. Otherwise, running with the default JUnit test configuration will only result in a console that does not receive input
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码
