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 |
Can we have this () and super () together?
Explain the polymorphism principle?
When should we create our own custom exception classes?
How many java versions are there?
is it possible to instantiate the math class?
Difference between ‘>>’ and ‘>>>’ operators in java?
What are the differences between the constructors and methods?
What is meant by class and object in java?
Why isn’t there operator overloading?
what are literals in java?
what is difference between abstract and interface? can i give real time example for the two topics?
Can we sort set in java?