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



Hi friends i want display Triangle shap stars(*) please can tell me any one java code logic? ..

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

Hi friends i want display Triangle shap stars(*) please can tell me any one java code logic? ..

Answer / royal

Thanks Sadik............

Is This Answer Correct ?    4 Yes 0 No

Post New Answer

More Core Java Interview Questions

Can a constructor be made final?

0 Answers  


What are variable names?

0 Answers  


Is integer immutable in java?

0 Answers  


What is an infinite loop?

0 Answers  


What are instance variables?

0 Answers  






Which oo concept is achieved by using overloading and overriding?

0 Answers  


How can we access some class in another class in java?

0 Answers  


What is the difference between Synchronizing mehtod & Synchronizing block?

2 Answers  


Why is logger singleton?

0 Answers  


Nullpointer exception is a very common exception. Why is it not made as a checked exception?

2 Answers   Ness Technologies,


Is string is a data type?

0 Answers  


What is the specification of ?CODEBASE? in an applet?

1 Answers  


Categories