My Java Notes
My Java Notes
int i = 0;
while (i < 5) {
System.out.println(i);
i++;
Do not forget to increase the variable used in the condition, otherwise the loop will never end!
class project1 {
public static void main(String a[])
{
int i =0;
while( i <=5)
{
System.out.println("hi");
int j=1;
while (j<3) {
System.out.println("good");
j++;
}
i++;
}
System.out.println(i);
}
}
int i = 0;
do {
System.out.println(i);
i++;