A JAVA program to show a patterns of stars on the screen.
First make a java project and then make class of name Star and then write down this whole code.
public class Star {
public static void main(String[] args) {
for(int i=1;i<=3;i++)
{
for(int j=3;j>i;j--)
{
System.out.print(""); //to print a blank space
}
for(int k=0;k<i*2-1;i++)
{
System.out.print("*"); // to print asterick*
}
System.out.println(); // to goto next line
}
}
}
guess i still need to practice on looping code.. im too noob.
ReplyDeleteVery neat java code. It helped me to understand for loop and various star pattern programs
ReplyDelete