- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to print data of specific element from an array in java?
An array is a data structure/container/object that stores a fixed-size sequential collection of elements of the same type. The size/length of the array is determined at the time of creation.
The position of the elements in the array is called as index or subscript. The first element of the array is stored at the index 0 and, the second element is at the index 1 and so on.
Each element in an array is accessed using an expression which contains the name of the array followed by the index of the required element in square brackets.
You can access an array element using an expression which contains the name of the array followed by the index of the required element in square brackets. To print it simply pass this method to the println() method.
Example
public class PrintingElement { public static void main(String args[]){ int [] myArray = {23, 93, 56, 92, 39}; System.out.println(myArray[2]); } }
Output
56
- Related Articles
- How to remove a specific element from a JSON Array in Java?
- How to remove an element from an array in Java
- How to switch data from an array to array list in java?
- How to remove a specific element from array in MongoDB?
- How to remove Specific Element from a Swift Array?
- How to read data from scanner to an array in java?
- How to move an element of an array to a specific position (swap)?
- How to move an array element from one array position to another in Java?
- JavaScript code to print last element of an array
- MongoDB query to get record beginning with specific element from an array?
- How to copy a specific section of an array in Java?
- Java program to Print Odd and Even Number from an Array
- Can i refer an element of one array from another array in java?
- How to delete element from an array in MongoDB?
- How do you print the content of an array in Java?

Advertisements