Java             3GL - .   4GL -     DB-

JAVA

Java

Java , , . Java, 7.

Java -, . Java : byte, short, int, long, char, float, double boolean. :

  1. . byte, short, int long. .
  2. float double. , .
  3. char. , , .
  4. boolean. , .

Java, , . , . .

Java . . , byte 080, -1.

, , . , , mask, , . ((unsigned) mask) >> 2. Java . mask>>>2. .

Java . 4 , 1, 2, 4 8 . byte, short, int long, .

byte

byte 8- . -128 127. , .

byte b;

byte = 055;

, byte, , . , , int.

short

short 16- . -32768 32767. , , Java , , , .

short s;
short t = Ox55aa;

, , , short , . SPARC Power PC, Intel x86. Java , .

int

int 32- . -2147483648 2147483647. , . . 32- , 64- 32- . , byte, short, int , int.

int i;

int j = 0x55aa0000;

long

long 64- . , .

long m;

long n = 550000550000;

. Java , , , . , Java byte short 32- , ( 8 , 8086 16 , 80386/486 32 , Pentium 64 ).

.

long 64 -9, 223, 372, 036, 854, 775, 808.. 9, 223, 372, 036, 854, 775, 807
Int 32 -2, 147, 483, 648.. 2, 147, 483, 647
Short 16 -32, 768.. 32, 767
byte 8 -128.. 127

, , , . Java (IEEE-754) float double . .

double 64 1. 7-308.. 1. 7+ 308
float 32 3. 4-038.. 3. 4+ 038

float

, , float, 32 .

float f;

float f2 = 3. 14F; // F, .. double

double

, double, 64 . , , sin, cos, sqrt, double.

double d;

double pi = 3. 14159265358979323846;

(type casting) C++, Java. , - , . , . Java , - . , , byte short int. (widening) (promotion), () . int , byte, . , int byte . (narrowing), , , . , . ( int) ( byte). byte , byte ( ).

int a = 100;

byte b = (byte) a;

, , , , .

byte a = 40;

byte b = 50;

byte = 100;

int d = a* b / ;

(* b) byte . Java int, (* b) .

. , , , . 50* 2, byte, . - int int byte .

byte b = 50;

b = b* 2;

^ Incompatible type for =. Explicit cast needed to convert int to byte.

( =. int byte)

:

 

byte b = 50;

b = (byte) (b* 2);

b 100.

byte, short int, int. long, long. He , , L ( 1), int.

float, float. double, double. Java , double. , .

class Promote {

public static void main (String args []) { byte b = 42;

char = 'a';

short s = 1024;

int i = 50000;

float f = 5.67f;

double d =.1234;

double result = (f* b) + (i/ c) - (d* s);

System. out. println ((f* b)+ "+ "+ (i / )+ " - " + (d* s));

System. out. println ("result = "+ result);

}

}

f* b float, byte. float. i / ( int, char) int. d* s (double, short) double. float, int double. int float float. double double. double.

Java Unicode, char 16 . Unicode. char 0..65536. Unicode , , , , .

char c;

char c2 = Oxf132;

char c3 = ' a';

char c4 = '\n';

char , , , . , . , , , .

int three = 3;

char one = '1';

char four = (char) (three+ one);

four '4'. one int, four .

boolean

Java boolean, . true () false (). boolean , ( < b) . , 6 , boolean , , if, while, do.

boolean done = false;

...

, , , , . .

class SimpleTypes {

public static void main(String args []) {

byte b = 055;

short s = 0x55ff;

int i = 1000000;

long l = 0xffffffffL;

char = ' a' ;

float f = .25f;

double d = .00001234;

boolean bool = true;

System.out.println("byte b = " + b);

System.out.println("short s = " +s);

System.out.println("int i = " + i);

System.out.println("long l = " + l);

System.out.println("char = " + );

System.out.println("float f = " + f);

System.out.println("double d = " + d);

System.out.println("boolean bool = " + bool);

} }

, , :

: \> java SimpleTypes

byte b = 85

short s = 22015

int i = 1000000

long l = 4294967295

char =

float f = 0.25

double d = 1.234e-005

boolean bool = true

, , . 12 , .

. month_days, int.

int month_days [];

, , new. new month_days .

month_days = new int [12];

, month_days . , , ().

class Array {
public static void main (String args []) {
int month_days[];
month_days = new int[12];
month_days[0] = 31; 
month_days[1] = 28;
month_days[2] = 31;
month_days[3] = 30;
month_days[4] = 31;
month_days[5] = 30;
month_days[6] = 31;
month_days[7] = 31;
month_days[8] = 30;
month_days[9] = 31;
month_days[10] = 30;
month_days[11] = 31;
System.out.println("April has " + month_days[3] + " days.");
} }

, . Java , month_days [3].

: \> java Array 

April has 30 days.

, . , . . , , .

class AutoArray {

public static void main(String args[]) {

int month_days[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

System.out.println("April has " + month_days[3] + " days.");

} }

, , .

Java , , . , , , . 10 , .

, Java . , , . double, . double.

double matrix [][] = new double [4][4];

, . , , .

double matrix [][] = new double [4][];
matrix [0] = new double[4];
matrix[1] = new double[4];
matrix[2] = new double[4], matrix[3] = { 0, 1, 2, 3 };

4 4 double, (, ==) , .

class Matrix {
public static void main(String args[]) { double m[][];
m = new double[4][4];
m[0][0] = 1;
m[1][1] = 1;
m[2][2] = 1;
m[3][3] = 1;
System.out.println(m[0][0] +" "+ m[0][1] +" "+ m[0][2] +""+ m[0][3]);
System.out.println(m[1][0] +" "+ m[1][1] +" "+ m[1][2] +""+ m[1][3]);
System.out.println(m[2][0] +" "+ m[2][1] +" "+ m[2][2] +""+ m[2][3]);
System.out.println(m[3][0] +" "+ m[3][1] +" "+ m[3][2] +""+ m[3][3]);
}
}

, :

C : \> Java Matrix
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1

, , , .

, . , , , . , , .

class AutoMatrix {
public static void main(String args[]) { double m[][] = {
{ 0*0, 1*0, 2*0, 3*0 }, { 0*1, 1*1, 2*1, 3*1 }, { 0*2. 1*2, 2*2, 3*2 },
{ 0*3, 1*3. 2*3, 3*3 } }:
System.out.println(m[0][0] +" "+ m[0][1] +" "+ m[0][2] +""+ m[0][3]);
System.out.println(m[1][0] +" "+m[1][1] +" "+ m[1][2] +""+ m[1][3]);
System.out.println(m[2][0] +" "+m[2][1] +" "+ m[2][2] +""+ m[2][3]);
System.out.println(m[3][0] +" "+m[3][1] +" "+ m[3][2] +""+ m[3][3]);
} }

, :

: \> Java AutoMatrix
0 0 0 0
0 1 2 3
0 2 4 6
0 3 6 9

, Java. , . , . boolean , , 9, . , . .

Java             3GL - .   4GL -     DB-


, - , . , push .




 10.11.2021 - 12:37: - Personalias -> WHO IS WHO - - _.
10.11.2021 - 12:36: - Conscience -> . ? - _.
10.11.2021 - 12:36: , , - Upbringing, Inlightening, Education -> ... - _.
10.11.2021 - 12:35: - Ecology -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> . - _.
10.11.2021 - 12:34: , , - Upbringing, Inlightening, Education -> , - _.
10.11.2021 - 09:18: - New Technologies -> , 5G- - _.
10.11.2021 - 09:18: - Ecology -> - _.
10.11.2021 - 09:16: - Ecology -> - _.
10.11.2021 - 09:15: , , - Upbringing, Inlightening, Education -> - _.
10.11.2021 - 09:13: , , - Upbringing, Inlightening, Education -> - _.
Bourabai Research -  XXI Bourabai Research Institution