Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
class Example {
static void main(String[] args) {
//Example of a int datatype
int x = 5;
//Example of a long datatype
long y = 100L;
//Example of a floating point datatype
float a = 10.56f;
//Example of a double datatype
double b = 10.5e40;
//Example of a BigInteger datatype
BigInteger bi = 30g;
//Example of a BigDecimal datatype
BigDecimal bd = 3.5g;
println(x);
println(y);
println(a);
println(b);
println(bi);
println(bd);
}
}
def minmaxSearch2(A)
{
max = 0
min = 0
j = 1
while (j < (A.size()-1))
{
if (A[j] > A[max]) max = j
if (A[j] < A[min]) min = j
j++
}
return A[min] + " und " + A[max]
}
A = [1, 7, 234, 23, 44, 5, 88, 3]
println "Das Feld " + A + " hat unter und obere Grenze von " + minmaxSearch2(A) + "."
def int powerOfN (int x, int n) {
int result = 1;
for (int i = 0; i < n; i++) {
result = result * x;
}
return result;
}
int myCalculation = powerOfN (2, 3);
System.out.print(myCalculation);