+ 1

I am having problem in this code please someone solve this I have tried so many times to solve this but failed.

import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner read = new Scanner(System.in); int password; do{ System.out.println("Write password"); password = read.nextlnt(); } while(password != 8819); } } Find the error solve it and let me know about the fault I was making.

11th Aug 2022, 3:29 AM
Priyanshu Singh
11 Antworten
+ 3
Awesome when I make mistakes It still helps! Now that's motivation. 😂 But because of that I will test my solution 3x over before I submit anything else. Thanks for being so kind😃
11th Aug 2022, 4:07 AM
Chris Coder
Chris Coder - avatar
+ 2
Priyanshu Singh your code is almost identical to mine with the exception in the do section I have those lines reversed as .. do { password = read.nextInt(); System.out.println("Write password"); } while (password != 8819); } } When I used your code it passed
11th Aug 2022, 3:52 AM
BroFar
BroFar - avatar
+ 2
Sorry Priyanshu Singh it was my app showing the inserted characters. It used to be a problem for others. But in this case it wasn't a problem for you. I thought I deleted my statements before you read them.
11th Aug 2022, 4:01 AM
Chris Coder
Chris Coder - avatar
+ 2
there is typo in .nextlnt(); because low L has similar visual as big I
11th Aug 2022, 4:51 AM
zemiak
+ 2
zemiak that is a capital i not l as in l-ike but i- as in ike
11th Aug 2022, 4:53 AM
BroFar
BroFar - avatar
+ 2
Those (upper-case I and lower-case L) can be tricky 😅
11th Aug 2022, 5:01 AM
Chris Coder
Chris Coder - avatar
+ 1
Thanks BroFar for your help. But It was a given program by this app. So I couldn't change those lines. That's why I tried nextShort instead of nextlnt. Thanks again BroFar.
11th Aug 2022, 3:59 AM
Priyanshu Singh
+ 1
😂😂
11th Aug 2022, 4:08 AM
Priyanshu Singh
0
Chris Coder thanks for your help man, But it was a mistake I was giving nextlnt() instead of nextShort() and because of that it was showing error. Thanks again man for reply.
11th Aug 2022, 3:56 AM
Priyanshu Singh
0
Its Ok Brother. No problem. I am thankful that you replied to my comment and that gave me motivation to read those lessons again. Because of that I find out which mistake I was making. Thanks Man. Don't be sorry.
11th Aug 2022, 4:04 AM
Priyanshu Singh
0
Like
13th Oct 2022, 2:30 PM
Narendra Prasad dahit