import javax.swing.*;
public class NestedLoop
{
public static void main(String args[])
{
for(int x=0;x< 5;x++)
{
for(int y=0;y<=x;y++)
{
System.out.print("*");
}// end innerloop
System.out.println("");

}//end outerloop
System.out.println();
}//end main
}//end class

Recommended Answers

@miltondollar- what are you trying to achieve? According to your program you are trying to print "*" in a particular fashion and you are importing the swing package?????

Jump to Post

All 2 Replies

You forget something....................

@miltondollar- what are you trying to achieve? According to your program you are trying to print "*" in a particular fashion and you are importing the swing package?????

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.