public class LessThanTooShortExample
{
public static void main(String args[])
{
// LessThanTooShortExample
String s = "x";
while (s.length() < 4)
{
System.out.println(s + " is too short.");
s = s + "x";
}
System.out.println("All Done.");
}
}
x is too short. xx is too short. xxx is too short. All Done.
--- Output Ends ---
- javac LessThanTooShortExample.java
- java LessThanTooShortExample