Философия Java


Руководство по операторам - часть 3


//! f(x && y);

//! f(x || y);

// Битовые операторы:

x = ~y; x = x & y; x = x | y; x = x ^ y; x = x << 1; x = x >> 1; x = x >>> 1; // Совмещение присвоения:

x += y; x -= y; x *= y; x /= y; x %= y; x <<= 1; x >>= 1; x >>>= 1; x &= y; x ^= y; x |= y; // Приведение:

//! boolean b = (boolean)x;

char c = (char)x; byte B = (byte)x; short s = (short)x; long l = (long)x; float f = (float)x; double d = (double)x; } void longTest(long x, long y) { // Арифметические операторы:

x = x * y; x = x / y; x = x % y; x = x + y; x = x - y; x++; x--; x = +y; x = -y; // Сравнение и логика:

f(x > y); f(x >= y); f(x < y); f(x <= y); f(x == y); f(x != y); //! f(!x);

//! f(x && y);

//! f(x || y);

// Битовые операторы:

x = ~y; x = x & y; x = x | y; x = x ^ y; x = x << 1; x = x >> 1; x = x >>> 1; // Совмещение присвоения:

x += y; x -= y; x *= y; x /= y; x %= y; x <<= 1; x >>= 1; x >>>= 1; x &= y; x ^= y; x |= y; // Приведение:

//! boolean b = (boolean)x;

char c = (char)x; byte B = (byte)x; short s = (short)x; int i = (int)x; float f = (float)x; double d = (double)x; } void floatTest(float x, float y) { // Арифметические операторы:

x = x * y; x = x / y; x = x % y; x = x + y; x = x - y; x++; x--; x = +y; x = -y; // Сравнение и логика:

f(x > y); f(x >= y); f(x < y); f(x <= y); f(x == y); f(x != y); //! f(!x);

//! f(x && y);

//! f(x || y);

// Битовые операторы:

//! x = ~y;

//! x = x & y;

//! x = x | y;

//! x = x ^ y;

//! x = x << 1;

//! x = x >> 1;

//! x = x >>> 1;

// Совмещение присвоения:

x += y; x -= y; x *= y; x /= y; x %= y; //! x <<= 1;

//! x >>= 1;

//! x >>>= 1;

//! x &= y;

//! x ^= y;

//! x |= y;

// Приведение:

//! boolean b = (boolean)x;

char c = (char)x; byte B = (byte)x; short s = (short)x; int i = (int)x; long l = (long)x; double d = (double)x; } void doubleTest(double x, double y) { // Арифметические операторы:




Начало  Назад  Вперед



Книжный магазин