Write a program to search a number in the given list of numbers.
Answer / Raghaw Kumar Jha
Here's an example of a simple Java program that searches for a number in an array:
```java
public class SearchNumber {
public static void main(String[] args) {
int numbers[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
int target = 5;
for (int i = 0; i < numbers.length; i++) {
if (numbers[i] == target) {
System.out.println(target + " found at position: " + (i+1));
break;
}
}
}
}
```
| Is This Answer Correct ? | 0 Yes | 0 No |
What programs use java?
What is constructor and virtual function?
What makes a function well defined?
what is the output ? Math.floor(-2.1) a)2 b)-2 c)-3.0 d)0
Can we sort hashset in java?
Define packages in java?
What is a loop java?
Can we call thread start () twice?
What is garbage collection in Java, and how can it be used ?
32 Answers Accenture, HCL, Infosys, Sara, SITS, TCS, Wipro,
What is class variable java?
What is the use of collections in java? How it is implemented in real time applications?
I/O blocking means?