Home > Java > javaTutorial > Java Example - Array Output

Java Example - Array Output

黄舟
Release: 2017-02-18 10:06:01
Original
1250 people have browsed it

The following example demonstrates how to output an array through a loop:

/*
 author by w3cschool.cc
 文件名:Main.java
 */public class Welcome {
   public static void main(String[] args){
      String[] greeting = new String[3];
      greeting[0] = "This is the greeting";
      greeting[1] = "for all the readers from";
      greeting[2] = "Java Source .";
      for (int i = 0; i < greeting.length; i++){
         System.out.println(greeting[i]);
      }
   }}
Copy after login

The output result of the above code is:

This is the greeting
For all the readers From
Java source .
Copy after login

The above is the Java example - the content of the array output, For more related content, please pay attention to the PHP Chinese website (m.sbmmt.com)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template