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 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!! ;-)


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 write 55555 4444 333 22 1 in java?

To print the given sequence in Java, you can use a loop to iterate through each number and print it the corresponding number of times. Here's an example code snippet to achieve this: public class NumberSequence { public static void main(String[] args) { int[] numbers = {5, 4, 3, 2, 1}; for (int num : numbers) { for (int i = num; i &gt;= 1; i--) { System.out.print(num); } System.out.print(&quot; &quot;); } } } This code will output: 55555 4444 333 22 1


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 print kamal kama kam ka k this pattern in qbasic?

QBASIC CODE/START... ==== ...QBASIC CODE/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 new version of Java?

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