Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Java: If, Else, While, litle program
import java.util.Scanner; class Rextester { public static void main(String[] args) { int start = 0; System.out.println("Enter an Integer: "); Scanner inputFromUser = new Scanner(System.in); int finish; if (inputFromUser.hasNextInt()){ finish = inputFromUser.nextInt(); System.out.println("Enter an String: "); }else{ finish = 1; System.out.println("Play by the rules,Enter an String: "); } Scanner inputWords = new Scanner(System.in); String words = inputWords.nextLine(); while(start<finish){ System.out.println(words); start += 1; } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
hello_world_test
1
dimond of stars
Catalan number optimised
jb11.0 threads tick tock 1.0
Java consecutive repeated cha
doubt
Quadratic_Equation.java
Roberto02
Frequecy count hashmap
Please log in to post a comment.