Hi i am a beginner in Java and in my very first code i ran into a problem. The second loops has no output at all and that segment have 0% code coverage.
package loopyLoop;
public class Loopyloop {
public static void main (String[] args) {
int x = 1;
System.out.println ("The value of x:" +x);
while (x<3) {
System.out.println("In while loop");
x = x+1;
System.out.println("The current value of :" +x);
}
System.out.println("finally we are out of the loop");
}
class ifTest {
public void main (String[] args) {
int y = 2;
if (y < 3) {
System.out.println("The if clause is satisfied");
y = y+1;
}
else {
System.out.println("The clause is not satisfied");
}
}
}
}
Aucun commentaire:
Enregistrer un commentaire