xFactorSchool.com(Beta)
How to Do Examples
Python Examples
HTML Examples
Code Examples
C Code Examples
C++ Code Examples
C# Code Examples
Java Code Examples
Python Code Examples
HTML Code Examples
CSS Code Examples
JavaScript Code Examples
Online Editor
C Code Editor
C++ Code Editor
C# Code Editor
Java Code Editor
Python Code Editor
HTML Code Editor
CSS Code Editor
JavaScript Code Editor
Practice how to create an array in Java
Java Online Editor
Execute Code
More Java Sample Codes
public class ExampleApp { public static void main(String[] args) { // Creating a string array in one line using array declaration syntax String[] fruits = { "Apple", "Banana", "Cherry", "Orange", "Watermelon" }; // array of strings // Accessing an array element System.out.println(fruits[2]); // Output: Cherry // Creating an integer array in one line using array declaration syntax int[] numbers = { 1, 2, 3, 4, 5 }; // array of integers // Accessing an array element System.out.println(numbers[2]); // Output: 3 } }