answersLogoWhite

0


Best Answer

Use loops.

int i;

// for loop

for(i = 0; i < 10; ++i) {

System.out.println(i);

}

// do loop

i = 0;

do {

System.out.println(i++);

} while(i < 10);

// while loop

i = 0;

while(i < 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.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write a java code that executes or runs many times?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering
Related questions

Is jvm a compiler or an interpreter?

JVM is an Interpreter because it interprets the Java Byte Code which it is feed and then it executes it line by line.


I have a computer science class and I need to make a java file that executes with conditional operations and iterative operations. How do you make a java file with conditional and iterative?

This is what you need in your class code. 1. Main Method - So that you can execute it 2. If - else block - Where you have conditions 3. For or while loop - Where there is iterative code Note: I can write the code here but wiki is not the place to get your homework done.


How do you write a java program for finding multiligual languages?

You can use Java's built-in functions to write a code that will find multilingual languages.


What is Re usability in java?

Reusability in Java means that once you write some code, you can use it over and over again - if you write it so that it can be reused. For example, if you write a Enumeration-Iterator adapter, or some code that lets you treat an Enumeration - Java legacy code - as an Iterator - shiny NEW Java code - then you can use it not only in your animal simulation program, but also in your Jacuzzi interface program.


Write a java code to draw a circle inside in an ellipse?

write a program draw circle and ellipse by using oval methods in java


What command executes the Java class file Welcomeclass?

I assume you meant Welcome.class, in which case, it would be: java Welcome


What is java file in java?

A java file contains the code you write. One java file contains one class so for example when I want to make a class called Person, the source code is saved in Person.java


What is the providence of US?

The JRE refers to Java Runtime Environment... JRE is an implementation of the Java Virtual Machine which actually executes Java programs. Without the JRE we cannot execute our Java programs.


What is the difference between Java IDE and JVM?

Java Virtual Machine is a program that runs pre compiledJavaprograms, which mean JVM executes .class files (byte-code) and produces output. The JVM is written for each platform supported by Java included in the Java Runtime Environment (JRE). The Oracle JVM is written in the C programming language.


What is the use of providing jre?

The JRE refers to Java Runtime Environment... JRE is an implementation of the Java Virtual Machine which actually executes Java programs. Without the JRE we cannot execute our Java programs.


How doese improvethe perfomeance of the java about multythreadinng?

Multithreading allows you to use the extra power of multi-cored processors. It also allows multiple parts of your code to be executes at once. This means that slow executing code will not hold up the other lines of code following it.


How do you work in java?

Loops in java are used so you don't have to write the same code over and over again. A basic example of this would be using for(int i = 0; i &lt; 4; i ++){ system.out.println("example"); } instead of writing system.out.println("example"); four times yourself