Hi, I am very new to java programming. I would like to let user enter the number greater than 0, and if i entered number is 0 then would inform user with message and let enter that number again. There are many inputs in program that have same conditions.
I would think of that code, but it says dublicate variables or something. Anyway i hope you get the idea....
and so on....System.out.print( "Type first number: " ); int a= scanner.nextInt(); if (a<=0){ System.out.println("Must be more above 0"); System.out.print( "Type first number: " ); int a=scanner.nextInt(); } System.out.print( "Type second number: " ); int b=scanner.nextInt(); if (b<=0){ System.out.println("Must be more above 0"); System.out.print( "Type first number: " ); int a=scanner.nextInt(); }