I am using a for loop and i want to print anwer vertically with the number. but rite now i am getting the answer horizontally i also \n but no luck below is the code.

 public String getMultiStringInformation(int num, String str) throws RemoteException
    {

      String result = "\n";



      for ( int i=0; i<num; i++ )
      {
        result = result + str + " ";
      }

      return result;
    }

System.out.println("\tThe result is "+MultiStringInfo);

the result which i get is like, 1 2 3.... but i want like
1
2
3

can anybody please help me

for ( int i=0; i<num; i++ )
{
result += str + "\n";
}
for ( int i=0; i<num; i++ )
{
result += str + "\n";
}

===========================
Thanks alot dear, really thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.