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"); } } } }

12th Jan 2019, 2:16 PM
mahmudur rehman
mahmudur rehman - avatar
2 Respuestas
+ 8
● try changing .nextLine() to .next() 👍
12th Jan 2019, 4:36 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
0
I solve it with.. String quote = scanner.next(); Quote+=nextLine();
13th Jan 2019, 3:01 PM
mahmudur rehman
mahmudur rehman - avatar