+ 1

Hi guys! I got a question. How do you secure the entry in a program you write in c or java?

like if you ask the user to enter a number of type int, how do you prevent the user to enter for example a string, a name or a double? like if I want to get only int: Scanner number = new Scanner(Sustem.in); int UserNumber = number.nextInt; I want such a program to give an error message once the entry is not an "int value "

7th Mar 2018, 10:19 PM
Itaka G. Kitambala
Itaka G. Kitambala - avatar
4 odpowiedzi
+ 4
by providing acess specifiers we will give security like private public protected default in the security isssue java is more helpful
8th Mar 2018, 1:24 AM
gnaneswari kolathuru
gnaneswari kolathuru - avatar
0
ok. I'll make research about that
7th Mar 2018, 10:29 PM
Itaka G. Kitambala
Itaka G. Kitambala - avatar
0
thanks anyway buddy!
7th Mar 2018, 10:29 PM
Itaka G. Kitambala
Itaka G. Kitambala - avatar
0
ok I see that. thanks for your contribution
8th Mar 2018, 9:27 AM
Itaka G. Kitambala
Itaka G. Kitambala - avatar