0
why my if loop works with testcase?? what's problem here?
import java.util.Scanner; public class fancyquote { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scanner = new Scanner(System.in); int testcase = scanner.nextInt(); while(testcase-->0) { String quote = scanner.nextLine(); if(quote.toLowerCase().matches("not")) { System.out.println("Real Fancy"); } else { System.err.println("regular Fancy"); } } } }
2 odpowiedzi
+ 8
● try changing .nextLine() to .next() 👍
0
I solve it with..
String quote = scanner.next();
Quote+=nextLine();