# Java
## Definition(s)
### Context : [[Nexus - Google Analytics Certificate Course#7.1 Google Analytics - 7 Data Analysis with R Programming - Module 1 - Programming and data analytics Programming and data analytics|Google Analytics Certificate]]
#### Sub-context: [[Programming Language]]
>[! Definition]
>A programming language widely used to create enterprise web applications that can run on multiple clients
## Examples
```java
// Hello World program
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
```
```java
// Java implementation of iterative Binary Search
class BinarySearch {
int binarySearch(int a[], int l, int r, int x)
{
while (l <= r) {
int m = (l + r) / 2;
// Index of Element Returned
if (a[m] == x) {
return m;
// If element is smaller than mid, then
// it can only be present in left subarray
// so we decrease our r pointer to mid - 1
} else if (a[m] > x) {
r = m - 1;
// Else the element can only be present
// in right subarray
// so we increase our l pointer to mid + 1
} else {
l = m + 1;
}
}
// No Element Found
return -1;
}
public static void main(String args[])
{
BinarySearch ob = new BinarySearch();
int a[] = { 2, 3, 4, 10, 40 };
int n = a.length;
int x = 10;
int res = ob.binarySearch(a, 0, n - 1, x);
if (res == -1)
System.out.println("Element not present");
else
System.out.println("Element found at index " + res);
}
}
```
## Related
[[Programming Language]]
## Resources
## Flashcards
The below code are generated for use with [Spaced Repetition plugin](https://github.com/st3v3nmw/obsidian-spaced-repetition/) [docs](https://www.stephenmwangi.com/obsidian-spaced-repetition/)