answersLogoWhite

0


Best Answer

Its simple:

String a="Suraj Acharya"//consider this to be your string

for(int i=0;i<a.length();i++)

System.out.println("Its Simple");

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: In java how do you use a for loop to print out a word as many times of its length?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you exit in nested loop in java?

You may exit a nested loop in Java using a break with a label for the outer loop.


What are various loops available in java?

Java has three kinds of loops 1. For Loop 2. While Loop 3. Do - While Loop Both For loop and While loop would iterate through a certain lines of code within the loop's limit as long as the loop condition is satisfied. A do while loop would execute the loop once even before checking the condition. So in a do while loop, even if the loop condition is not satisfied the loop would execute once. Example Declarations: for(int i = 0; i &lt; n; i++) { ..... } while (i &lt; n) { ... i++; } do { ... i++; } while (i &lt; n) ;


What time of loop is used when you know how many times the loop instructions should be processed?

It's best to use a for loop.For example, if you want 10 iterations:for (int i = 1; i


How do you write a java code that executes or runs many times?

Use loops. int i; // for loop for(i = 0; i &lt; 10; ++i) { System.out.println(i); } // do loop i = 0; do { System.out.println(i++); } while(i &lt; 10); // while loop i = 0; while(i &lt; 10) { System.out.println(i++); } Each of the above blocks of code will print the values 0-9. Replace the body of the loops to make the code it executes useful. Replace the conditions to change when the loops exit.


Write a java program to print the result in the series?

If you have the series stored in an array, you loop through the array and print each array element in turn. Another possibility is to print out the numbers in the series as you generate them. In that case, you may not need to store anything (depending on the series, of course).

Related questions

How do you exit in nested loop in java?

You may exit a nested loop in Java using a break with a label for the outer loop.


What are various loops available in java?

Java has three kinds of loops 1. For Loop 2. While Loop 3. Do - While Loop Both For loop and While loop would iterate through a certain lines of code within the loop's limit as long as the loop condition is satisfied. A do while loop would execute the loop once even before checking the condition. So in a do while loop, even if the loop condition is not satisfied the loop would execute once. Example Declarations: for(int i = 0; i &lt; n; i++) { ..... } while (i &lt; n) { ... i++; } do { ... i++; } while (i &lt; n) ;


What time of loop is used when you know how many times the loop instructions should be processed?

It's best to use a for loop.For example, if you want 10 iterations:for (int i = 1; i


What are functions in JAVA?

for loop function


When is Iteration used in a Java program?

in a loop


How do you write a java code that executes or runs many times?

Use loops. int i; // for loop for(i = 0; i &lt; 10; ++i) { System.out.println(i); } // do loop i = 0; do { System.out.println(i++); } while(i &lt; 10); // while loop i = 0; while(i &lt; 10) { System.out.println(i++); } Each of the above blocks of code will print the values 0-9. Replace the body of the loops to make the code it executes useful. Replace the conditions to change when the loops exit.


Write a java program to print the result in the series?

If you have the series stored in an array, you loop through the array and print each array element in turn. Another possibility is to print out the numbers in the series as you generate them. In that case, you may not need to store anything (depending on the series, of course).


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


How do you print non-prime numbers in java?

Loop through some numbers - for example, 2 through 100 - and check each one whether it is a prime number (write a second loop to test whether it is divisible by any number between 2 and the number minus 1). If, in this second loop, you find a factor that is greater than 1 and less than the number, it is not a prime, and you can print it out.


How do you calculate loop length?

the multiplication of the number of iterations with the number of statements in that loop is equal to loop length.


How can you repeatedly execute a code in java script?

1) use for loop 2) do while loop


How write java program type a number print out many hash character give a example how its done please?

Use the System.out.println() to do the actual printing. In Java, you can directly concatenate (combine) a number with a text. For example, if your number is in the variable called "x": System.out.println(x + "#####"); If you want to combine different print commands, for example to print several hash characters in a loop, note that println() will add a new line, while print() will not.