how to print the below in java?thanks in advance....
*
* *
* *
* *
*

Answer Posted / jitendra

for(i=1;i<=3;i++)
{
for(j=3;j>=i;j--)
System.out.printf(" ");
System.out.printf("*");
for(j=1;j<2+i;j++)
System.out.printf(" ");
System.out.printf("*");
System.out.printf("\n");
}
this is to print
*
* *
* *
now apply ur brain to print the rest...
any problem ..then mail me
jitendrasharma13@gmail.com

Is This Answer Correct ?    2 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain static nested classes ?

596


What is the differences between c++ and java? Explain

588


What are constructors in java?

574


Can we sort a map in java?

578


Can we extend a class with private constructor?

527






What is a get method?

535


Explain about member inner classes?

590


What is a class component?

615


What is concurrent hashmap and its features?

524


Difference between this() and super() in java ?

616


What is the difference between exception and error in java?

493


Does a class inherit the constructors of its superclass in java programming?

529


Define nashorn in java8.

570


Does java map allow duplicates?

493


What is multiple inheritance? Is it supported by java?

528