- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
Java Program to Check if An Array Contains a Given Value
Following is a Java program to check if An Array Contains a Given Value.
Example
public class Sample { public static void main(String args[]){ int[] myArray = {55, 45, 69, 44}; int num = 55; for(int i = 0; i<myArray.length; i++){ if(num == myArray[i]){ System.out.println("Array contains the given element"); } } } }
Output
Array contains the given element
- Related Articles
- Java Program to Check if An Array Contains the Given Value
- Golang Program to Check if An Array Contains a Given Value
- How to check if a Perl array contains a particular value?
- Java Program to check if a given value exists in a HashMap
- Check if an array contains all elements of a given range in Python
- C# program to check if a value is in an array
- How to check if a vector contains a given value in R?
- Java Program to Check if a string contains a substring
- Method to check if array element contains a false value in JavaScript?
- Check if a value is present in an Array in Java
- Check if a Java ArrayList contains a given item or not
- Java program to check if a string contains any special character
- C# program to find if an array contains duplicate
- How to check if array contains three consecutive dates in java?
- How to check if ArrayList contains an item in Java?

Advertisements