answersLogoWhite

0


Best Answer

For(int I = 0: I < 5; i++)

{

System.out.println(" print this " + I );

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you print a string 5 times in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How can you print a table of 5 in java by getting values from user?

look at the print


How do you print a symbol in Java when multiple of 5 occurs?

if x%5==0 { System.out.println("@"'); }


How can you initialize an array in Java?

If you refering to Object then String[] something=new String[2]; Here you have to remember that something only allocated space for 2 String object but it did not created them yet. By default Objects are intantiated to null so if you try to print the content of an array System.out.println(something[0]);//print null System.out.println(something[0].toLowerCase()); Throws NullPointerException Couple other ways to create Arrays In java String[] something=new String[]{"Me","You"}; String[] something={"Me", "You"};


Which is the best way to convert numbers in string under java?

All of the Java number classes have a parse[type] method, like parseInt() in Integer or parseDouble() in Double that convert Strings to primitive numbers. String s = getInput(); int var = Integer.parseInt(s);


How do you convert an integer to a string?

That really depends on the programming language. In Java, it is sufficient to concatenate it with a String: int myNumber = 5; result = "" + myNumber; Other languages may require a special function, or method, to convert from integer to string.


How do you play viva la vida on trumpet?

C# 5 times, then D# 5 times, then G# 4 times, and then, depending on which part of the song, it's F on the D string 5 times or F on the C string 5 times. Happy Viva la Viding!! ;-)


What is the longest factor string of 15?

5 times 3


Java code to print prime numbers from 1 to 10?

System.out.println("2, 3, 5, 7"); There are so few you dont need to calculate it


How do you write 55555 4444 333 22 1 in java?

You can do this with a nested loop: public static void main(String[] args){ for(int i=5, i&gt;0, i--){ for(int j=i, j&gt;0; j--) System.out.print(i); System.out.print(' '); } } The outer loop decrements the integer that you are printing and the inner loop will print the integer the number of times equal to its value.


How do you print kamal kama kam ka k this pattern in qbasic?

Cls Dim n as string Dim b as string b=&quot;Kamal&quot; For a=5 to 1 step -1 n=left$(b, a) Print n Next a End


Write a java program to print the following output using the for loop 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5?

12345 1234 123 12 1


What is the new version of java?

The latest version of java is called Java 5 or Tiger.