• Home
  • Whiteboard
  • Online Compilers
  • Practice
  • Articles
  • AI Assistant
  • Jobs
  • Tools
  • Corporate Training
  • Courses
  • Certifications
Login
    • Java
    • JSP
    • iOS
    • HTML
    • Android
    • Python
    • C Programming
    • C++ Programming
    • C#
    • PHP
    • CSS
    • Javascript
    • jQuery
    • SAP
    • SAP HANA
    • Data Structure
    • RDBMS
    • MySQL
    • Mathematics
    • 8085 Microprocessor
    • Operating System
    • Digital Electronics
    • Analysis of Algorithms
    • Mobile Development
    • Front End
    • Web Development
    • Selenium
    • MongoDB
    • Computer Network
    • General Topics
  • Library
  • Courses
  • Certifications
  • Login
  • SQL
  • HTML
  • CSS
  • Javascript
  • Python
  • Java
  • C
  • C++
  • PHP
  • Scala
  • C#
  • Tailwind CSS
  • Node.js
  • MySQL
  • MongoDB
  • PL/SQL
  • Swift
  • Bootstrap
  • R
  • Machine Learning
  • Blockchain
  • Angular
  • React Native
  • Computer Fundamentals
  • Compiler Design
  • Operating System
  • Data Structure and Algorithms
  • Computer Network
  • DBMS
  • Excel
Technical Questions and Answers
  • Data Structure Data Structure
  • Networking Networking
  • RDBMS RDBMS
  • Operating System Operating System
  • Java Java
  • MS Excel MS Excel
  • iOS iOS
  • HTML HTML
  • CSS CSS
  • Android Android
  • Python Python
  • C Programming C Programming
  • C++ C++
  • C# C#
  • MongoDB MongoDB
  • MySQL MySQL
  • Javascript Javascript
  • PHP PHP
  • Selected Reading
  • UPSC IAS Exams Notes
  • Developer's Best Practices
  • Questions and Answers
  • Effective Resume Writing
  • HR Interview Questions
  • Computer Glossary
  • Who is Who

Loop Through an Array in Java

JavaObject Oriented ProgrammingProgramming


Following example shows how to loop through an array using a foreach loop.

public class Tester {
   public static void main(String[] args) {
      int[] dataArray = {1, 2, 3, 4};
      for(int i: dataArray) {
         System.out.println(i);
      }
   }
}
radhakrishna
radhakrishna

Updated on: 2020-02-24T10:19:29+05:30

241 Views

  • Related Articles
  • How to loop through an array in Java?
  • How to use for each loop through an array in Java?
  • Loop through an ArrayList using an Iterator in Java
  • Loop through ArrayList in Java
  • Loop through a HashMap using an Iterator in Java
  • Loop through the Vector elements using an Iterator in Java
  • Loop through array and edit string JavaScript
  • How to loop through all the elements of an array in C#?
  • How to use for...in statement to loop through an Array in JavaScript?
  • How do you loop through a C# array?
  • Recursively loop through an array and return number of items with JavaScript?
  • Loop through an index of an array to search for a certain letter in JavaScript
  • Java Program to loop through Map by Map.Entry
  • Looping through an array in Javascript
  • Loop through a Dictionary in Javascript
Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements
TOP TUTORIALS
  • Python Tutorial
  • Java Tutorial
  • C++ Tutorial
  • C Programming Tutorial
  • C# Tutorial
  • PHP Tutorial
  • R Tutorial
  • HTML Tutorial
  • CSS Tutorial
  • JavaScript Tutorial
  • SQL Tutorial
TRENDING TECHNOLOGIES
  • Cloud Computing Tutorial
  • Amazon Web Services Tutorial
  • Microsoft Azure Tutorial
  • Git Tutorial
  • Ethical Hacking Tutorial
  • Docker Tutorial
  • Kubernetes Tutorial
  • DSA Tutorial
  • Spring Boot Tutorial
  • SDLC Tutorial
  • Unix Tutorial
CERTIFICATIONS
  • Business Analytics Certification
  • Java & Spring Boot Advanced Certification
  • Data Science Advanced Certification
  • Cloud Computing And DevOps
  • Advanced Certification In Business Analytics
  • Artificial Intelligence And Machine Learning
  • DevOps Certification
  • Game Development Certification
  • Front-End Developer Certification
  • AWS Certification Training
  • Python Programming Certification
COMPILERS & EDITORS
  • Online Java Compiler
  • Online Python Compiler
  • Online Golang Compiler
  • Online C Compiler
  • Online C++ Compiler
  • Online C# Compiler
  • Online PHP Compiler
  • Online MATLAB Compiler
  • Online Bash Compiler
  • Online SQL Compiler
  • Online Html Editor
  • ABOUT US |
  • OUR TEAM |
  • CAREERS |
  • JOBS |
  • CONTACT US |
  • TERMS OF USE |
  • PRIVACY POLICY |
  • REFUND POLICY |
  • COOKIES POLICY |
  • FAQ'S
tutorials point logo

Tutorials Point is a leading Ed Tech company striving to provide the best learning material on technical and non-technical subjects.

© Copyright 2025. All Rights Reserved.