Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Lukas18698y@altermind Haha..hit the bar too late :) I'll delete my stupid remark and ++ you sir;)
-
reesmid1078y@jdmkaan thank you. i see some changes in WHILE... great. I was practicing in an application on my phone. may be don't run correctly because that.
-
int x;
do{
x = scanner.nextInt();
if(x<16)
System.out.println("too young");
} while (x<16)
System.out.println("welcome"); -
@burungbangkai and here we observe a far easier way to go about problem solving
-
jdmkaan20488y@tisaconundrum nope. The program does not even take into account if the user messes up and enters something other than an integer. It needs to be able to rerun autonomously without ending and running again on user's end.
-
Isn't there a place for code help? It's called overstack, stackflow... What is that place...
Right! stackoverflow... Ah yes. Good old Stack Overflow. 😾 -
@jdmkaan while I understand what you're getting at. Well written code is also important and reducing redundancies saves you a lot of time and heartache for you and future developers who have to work with your code.
-
@ingenioushax stack overflow is fine. But it's a Terrible place for noobies, if they don't know how to ask questions that won't get down voted to death
-
int x = 0;
int minAge = 16;
Scanner scanner = new Scanner(system.in);
do
{
try
{
x = scanner.nextInt();
x < minAge ? system.out.println("Too young") : system.out.println("welcome");
}
catch(MismatchTypeException ex)
{
system.out.println("Enter a number you buffoon");
}
}while(x < minAge); -
And that snippet ladies and gents, is the second time I have ever written Java. 🤗
@reesmid
Here is a working implementation.
undefined