Hi friends i want display Triangle shap stars(*) please can
tell me any one java code logic?
*
***
*****
******* Like this
Answers were Sorted based on User's Feedback
Answer / sadikhasan palsaniya
public class Test{
public static void main(String var[]){
int c=1;
for(int i=1;i<=4;i++){
for(int k=4;k>=i;k--)
System.out.print(" ");
for(int j=1;j<=c;j++){
System.out.print("*");
}
System.out.println("");
c=c+2;
}
}
}
| Is This Answer Correct ? | 14 Yes | 5 No |
How do you replace a string in java?
How an object is serialized in java?
Java violates few objected oriented concepts. Can you explain in what way?
Why chararray() is preferred over string to store the password?
Is it possible to compare various strings with the help of == operator?
This abstract class is correct ? abstract class A { public abstract void Disp(); public abstract void B() { } public absract virtual C() { } }
How to display names of all components in a Container?
What state is a thread in when it is executing?
What will happen to the exception object after exception handling?
which method is used to know the status of the Thread?
Is string a data type in java?
Is java programming easy?