Skip to content

mkyong.com

  • Spring Boot
  • Java Virtual Threads
  • Contact
  1. Home /
  2. for loop

Tag: for loop

java January 31, 2020 5 min read by mkyong 5 comments

Java – How to print a name 10 times?

This article shows you different ways to print a name ten times. 1. Looping 1.1 For loop JavaSample1.java package com.mkyong.samples; public class JavaSample1 { public static void main(String[] args) { for (int i = 0; i < 10; i++) { System.out.println("Java "); } } } Output Java Java Java Java Java Java Java Java Java […]

Read more Java – How to print a name 10 times?
kotlin April 12, 2018 2 min read by mkyong 3 comments

Kotlin – How to Loop a Map

In Kotlin, you can loop a Map via the following ways: 1. for loop val items = HashMap<String, Int>() items["A"] = 10 items["B"] = 20 for ((k, v) in items) { println("$k = $v") } 2. forEach items.forEach { k, v -> println("$k = $v") } 1. For Loop Loop a Map and filter it […]

Read more Kotlin – How to Loop a Map

Java and Spring tutorials since 2008. Every example is a complete, runnable file, compiled and run on a real machine before it goes out.

About This Site

  • About
  • Editorial Policy
  • Contact
  • Code License
  • Privacy Policy
  • Terms of Use

© 2026 mkyong.com — Powered by WordPress

RSS