Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners how to create this diamond structure with java.

Have Programming Question? Ask it here!
 
 
 


astar
how to create this diamond structure with java.
1 Answer(s)      4 years and 7 months ago
Posted in : Java Beginners


*
***
***** *
*** ***
* ***** *
*** ***
* ***** *
*** ***
* *****
***
*

Advertisement
View Answers

January 23, 2010 at 4:53 PM


Hi Friend,

Try the following code:

class Stars{
public static void main(String []args){
for(int i=1;i<=5;i+=2){
System.out.println("");
for(int j=1;j<=i;j++)
System.out.print("*");
}
System.out.print(" *");
System.out.println();
for(int k=1;k<=2;k++){
for(int l=1;l<=3;l++){
System.out.print("*");
}
System.out.print(" ");
}
System.out.println();
for(int i=1;i<=2;i++){
System.out.print("*");
System.out.print(" ");
for(int j=1;j<=5;j++){
System.out.print("*");
}
System.out.println(" *");

for(int k=1;k<=2;k++){
for(int l=1;l<=3;l++){
System.out.print("*");
}
System.out.print(" ");
}
System.out.println();
}
System.out.print("* ");
for(int i=5;i>=0;i-=2){
for(int j=0;j<i;j++){
System.out.print("*");
}
System.out.println();
}
}
}

Thanks


Related Tutorials/Questions & Answers:
how to create this diamond structure with java. - Java Beginners
how to create this diamond structure with java.   * *** ***** * *** *** * ***** * *** *** * ***** * *** *** * ***** *** *   
how to create this structure in json using grails
how to create this structure in json using grails  { "query": { "type": "cluster", "view": "accountActivity", "regions": [2342,334,241,13], "companies": [43228583,433421683,342427783], "departments": [1,2,4,6], "brands
Advertisements
How to make a diamond necklace, make a diamond necklace, diamond necklace
How to make a diamond necklace       This tutorial will give you instruction to make draw a diamond necklace, so follow all the steps to make similar. New file: First take a new
Draw a diamond - Java Beginners
Draw a diamond  I want to draw a diamond shapein java using (*) in 9 lines. Here is the code import java.util.*; public class Diamond { static... the problem : import java.util.*; public class Diamond { static Scanner
Diamond - Java Beginners
Break out of if statement java  Hi, please explain how to break out of if statement in Java?  Hi Friend,public class PrintExam{ public static void main(String[] args){ int i; int j; for(i=1; i<7; i++){ for(j=0
why to create directory structure as web-inf & classes & lib - Java Beginners
why to create directory structure as web-inf & classes & lib    we all know that to prepare webapplications we will create a direcotry sturcture... actually what is the reason behind this creating this directory structure
why to create directory structure as web-inf & classes & lib - Java Beginners
why to create directory structure as web-inf & classes & lib    we all know that to prepare webapplications we will create a direcotry sturcture... actually what is the reason behind this creating this directory structure
DIAMOND PROGRAM - Java Interview Questions
DIAMOND PROGRAM  I Want Print Diamond ?I Want Code?plz help me  Hi Friend, Try the following code: public class PrintDiamond { public static void main(String[] args) { int n = 5; for (int i = -n
ARRAY DIAMOND - Java Interview Questions
ARRAY DIAMOND  HI I WANT PRINT LIKE THIS I Want Print In Diamond Shape? 1 2 3 4 5 6 5 4 3 2 1 4 3 2 1 3 2 1 2 1 1 I WANT SOURCE CODE?  Hi Friend, Try the following code: class
Diamond shape num - Java Interview Questions
Diamond shape num  How To Print Diamond Shape Numbers I Want Logic?Using For loops?  Hi Friend, Try the following code: public class Diamond{ public static void main(String[] args){ int row = 5; for(int i=1
how to create notepad in java
how to create notepad in java  how to create notepad in java
DIAMOND PROGRAM 122 - Java Interview Questions
DIAMOND PROGRAM 122  I Want Print Exact Diamond Shape?I Want Code ?Plz Help Me?  Hi Friend, Try the following code: public class Diamond{ public static void main(String[] args){ int row = 7; for(int i=1; i<
How to create a class in java
How to create a class in java  I am a beginner in programming and tried to learn how to do programming in Java. Friends please explain how can I create a class in Java
How to Create Keyboard in JAVA
How to Create Keyboard in JAVA  please help me to create On-Screen Keyboard with java and please give me an another idia to make it ..............iam waiting for your help ,think u so much
How to create charts in Java?
How to create charts in Java?  Is there any example of creating charts and graphs in Java? thanks   Hi, check the tutorial: Chart & Graphs Tutorials in Java Thanks
plzz tell me java code for that diamond
plzz tell me java code for that diamond   1 131 13531 1357531 13531 131 1
how to create interfaces in java
how to create interfaces in java  HI, Here is my code public interface validateInfo { public void validate(String empcode, String password); } class updateInfo implements validateInfo { public void update() { //code
how to create reports in swing java?
how to create reports in swing java?  how to create reports in swing java
How to create first program in Java?
How to create first program in Java?  Hi, I am new in Java programming. Tell me How to create first program in Java? Thanks   Hi, Read more at First Java Program. Thanks
In data structure in java how to parse the given string and counts the member of character that match the given data?
In data structure in java how to parse the given string and counts the member of character that match the given data?  Design a parser that parse the given string and counts the member of character that match the given data.using
how to create executable - Java Beginners
how to create executable  How do i create a executable file from a java file thnks in adv...!  Hi Friend, Try the following code: import java.io.*; import java.util.jar.*; public class CreateExe { public
how create package of this java code
how create package of this java code  Hi,i have email code in java which is working fine with out making package but when i want to make package of this code its stop working.Its showing exception while I execute it.I have to use
how create package of this java code
how create package of this java code  Hi,i have email code in java which is working fine with out making package but when i want to make package of this code its stop working.Its showing exception while I execute it.I have to use
java programming structure - Java Beginners
java programming structure  java programming structure  Hi Friend, The structure of Java programme is: [Package declarations] [Import statements] [Class declaration] [Method declaration] eg: package
What is a Loose Diamond?
and create true works of art for the perfect diamond. Now, if you... have the cut. The cut is the way the jeweler has finished the diamond and how the loose diamond reflects light and how it allows it to pass through
diamond print
diamond print   print the pattern 1 2 3 4 5 6 7 8 9 10 11 12
How to Display Data in a tree structure on the GUI
How to Display Data in a tree structure on the GUI  how to display data in a tree structure on the GUI? I need this sort of UI to display data showing a set of rules showing various conditions and the actions related
how to create exce sheet using java
how to create exce sheet using java  how to create excel sheet using java
how to create an excel file using java
how to create an excel file using java  how to create an excel file using java
how to create a header in jtable using java swing
how to create a header in jtable using java swing  how to create a header in jtable using java swing   d
how to create pdf file using java and itextjar
how to create pdf file using java and itextjar  How to create pdf file having paragraphs and alignments done using java and itextjar 5.10 version.? hope i get quick response
how to create pdf file using java and itextjar
how to create pdf file using java and itextjar  How to create pdf file having paragraphs and alignments done using java and itextjar 5.10 version.? hope i get quick response
how to create month wise serial number in java?
how to create month wise serial number in java?  Ex: For 1)January-serial number is 1/001,1/002,1/003 etc
How to Create Car Rental Application in Java ?
How to Create Car Rental Application in Java ?  Hi, How to Create a Car Renal Application using Java to Check the Car renting, booking... the car rental apps in Java
java how to create visual swing editor
java how to create visual swing editor   How do I create a visual swing designer in java ?Meaning that I can "draw" a button,a JTextArea from within my designer program . I just need some basics . I've got no idea how to start
how to create unit matrix in java of arbritary dimensions
how to create unit matrix in java of arbritary dimensions  i want to create the unit matrix of arbritary dimensions say (n*m).i m a new beginner to java.someone having the program for that? help would be appreciable
Structure of Java Arrays
Structure of Java Arrays       Now lets study the structure of Arrays in java. Array is the most widely used data structure in java. It can contain multiple values of the same
How to create new arraylist using Java
someone provides online example how to create new arraylist in java programming. thnaks,   Hi, In java programming language you can create new...How to create new arraylist using Java  hi, I want to develop
structure in JSP
structure in JSP  How do I achieve structure in JAVA or JSp
how we can create website through java
how we can create website through java  Dear actually i wanna ask query about creation of website through java then how we can create web site through java plz help me..........i have already a web site ....specially for premium
java data structure - Development process
java data structure  what is the minimum no of nodes for AVL tree whose height h=15? pls let me know the answer.  Hi Friend, Minimum node of nodes in AVL tree is equal to its height. Thanks
how to create forum on java subject in jsp/servlet ?
how to create forum on java subject in jsp/servlet ?  hi , i want to implement forum on java subject in jsp/servlet technology .how can i do it,which is the table required for it in mysql? formate like what is java is ? 2Reply
how can create album in java by using Stack ....
how can create album in java by using Stack ....  hi all , if i press push button put the image to the stack , and when i press pop button remove the image ..??? please help me please
How to Create Circle In Java
How to Create Circle In Java     ..., you will learn how to create Circle Diagram. The java circle is the most..., you will also show that how to create square drawing. Inside the program define
How to create Runtime time jLabel in java swing ?
How to create Runtime time jLabel in java swing ?   hi sir. my problem is that i want to display database row on a jLabel. Suppose i retrived... will itself enter the number of Jlabel that will create on Panel. if user enter-3, ther
which data structure is good in java..? - Java Beginners
which data structure is good in java..?  Hi frends, Actually i want to store and retrieve some data using data structures like array list, stack... anyone give me good example how that best technique i can use in my programs
How to create LineDraw In Java
How to create LineDraw In Java     ... will learn how to create Line Drawing. This program  implements a line Drawing component. A java program explains the stroke line i.e. how to make thick
how to Create a media player - Java Beginners
how to Create a media player  hi great friends my name is David.please i need a source code with detailed explanation on how to create a media player mp3 format.I need this urgently please!my E-mail address
how can create a jar file - Java Beginners
how can create a jar file  plz any one help me which file can i create the jar file plz give exact command  Hi The basic format... that you want to create a JAR file. * The f option indicates that you want
 

 

 

DMCA.com