Hi friends i want display Triangle shap stars(*) please can
tell me any one java code logic?
*
***
*****
******* Like this
Answer Posted / 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 |
Post New Answer View All Answers
Can we overload the constructors?
Explain about exception propagation?
Why is inheritance used in java?
Can static methods access instance variables in java?
What is the major difference between linkedlist and arraylist?
What is annotation in java?
Can we use different return types for methods when overridden?
How will you compute size of a structure?
Explain restrictions on using enum?
Is java util regex pattern thread safe?
Why java strings are immutable in nature?
what is object-oriented programming in java?
Is array dynamic in java?
What is a pattern what is an anti pattern?
Can a final variable be manipulated in java?