The following code example demonstrates how to Display Integers from 1 to 10 in Java.
In order to repeat a number of statements in the code, we use loops. Basically, java provides us while loop, do..while loop, and the for loop. The following program displays the integers in the range 1 to 10 separated by tabs.
public class Exercise10
{
public static void main(String[] args) {
for(int i=1;i<=10;i++)
{
System.out.print(i+"\t");
}
System.out.println();
}
}
Output

Further Reading
- Angular
- ASP.NET
- C
- C#
- C++
- CSS
- Dot Net Framework
- HTML
- IoT
- Java
- JavaScript
- Kotlin
- PHP
- Power Bi
- Python
- Scratch 3.0
- TypeScript
- VB.NET
