Tell me the programme for this


@
1 2
@ @ @
1 2 3 4

Answer Posted / sachin

package abc;

public class Sachin {

int n=4;
public static void main(String... args){
Sachin s=new Sachin();
for (int i=0;i<s.n;i++){
if(i%2==0){
for(int a=0; a<i+1;a++){
System.out.print("@");
}
}else{
for(int a=0; a<i+1;a++){
System.out.print(a+1);
}
}
System.out.println();
}
}
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the common usage of serialization?

574


What are the advantages of defining packages in java?

509


Why is java called java?

541


What do you mean by inner class in java? Explain

588


Can we define constructor in inner class?

542






What is the static field modifier?

598


What are different types of constants?

518


What is another word for methodology?

521


A person says that he compiled a java class successfully without even having a main method in it? Is it possible?

583


What are the types of literals?

562


Explain about the security aspect of java?

575


What is string manipulation?

498


Which programming language is best in future?

527


What does a method signature consist of?

509


What super () does in java?

486