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
}

}

}
Posted by Unknown On Sunday, May 26, 2013 2 comments

2 comments:

  1. guess i still need to practice on looping code.. im too noob.

    ReplyDelete
  2. Very neat java code. It helped me to understand for loop and various star pattern programs

    ReplyDelete

  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube

Like us

    as

    Contact Form

    Name

    Email *

    Message *