Академический Документы
Профессиональный Документы
Культура Документы
{int-�����
byte(-128...127)
short(-32768...32767
int(������ ��������)
long(����� ����� !!!)}
double-�������
float= 23f - ������� (���������� � ����� f)
String-������
char-������
boolean-Tree or False
����������
(/**/)-������� �����������
//-�������� �����������
�������������� ��������
˸����
+ - ���
- - �����
/ -������
* - ��������
^ - �������
% - ������� ��� �������
++ - ��� 1
-- - ����� 1
�������
Math.pow(b,2)-���������� � �������
Math.sqrt()-������ ����������
Math.tan(x*y)-�������
Math.sin()-�����
Math.cos()-�������
�������� ���������
������
if() - ����
else() - ��������� ���� �� ����������� if
&& - �
|| - ���
== - �����
!= - �� ����
< - ������
<= - ������ ���� �����
> - ������
>= - ������ ���� �����
�������
1) if(i!=10){
System.out.printl("i is not 10"); //���� ����-�� ��������� i �� ����� 10,
�� �� ����� ���������: i is not 10
}
2) if(i!=10){
System.out.println("i is not 10"); //���� ����-�� ��������� i �� ����� 10,
�� �� ����� ���������: i is not 10
} else{
System.out.println("i is unknown"); //� ���� ����-�� ��������� �� ��������
������� if, ������ �� ����� ���������:i is unknown
{
3) if(i!=10){
System.out.println("i is not 10"); //���� ����-�� ��������� i �� ����� 10,
�� �� ����� ���������: i is not 10
}
else if (i >100){
System.out.println("i ����� 100"); // � ���� ����-�� ��������� �� ��������
������� if, ������ ��������� ������� else (i > 100), � ���� �� ������, ��
���������: i ������ 100
}
else{
System.out.println("i is unknown");//���� �� � ������ ������� ��
���������, �� �� ����� ���������:i is unknown
}
5) else(i>100) || else(g<1000){
System.out.println("it's okey");// ���� i>100 ��� g<1000, �� �� �����
���������: it's okey
}
�����
�������:
-=10 - �������� �� 10
+=12 - ��������� �� 12
*= 30 - �������� �� 30
/=50 - ������ �� 50
3)
int y ; //������ ��������� �����
do{
While(y<1);{ //���� ���������� ���� ���� ������� �� ������, �� ������ 1 ���
System.out.println("y");} //����� ���������� �� �����
}
1)���������� ������
int [] arr=new int[3] {56, 76, 89}; // ������ ������ "arr" , ��������� �������
��������� � ������� "[3]" , ��������� ������� ������� "{56, 76, 89}
System.out,print(arr[1]);// ������� ������ ������� �������
for(i=0;i<4;i++){// ������ ���� ����� ������� ����� ��� ������� �����
System.out,print(arr[i]);
2)����������� ������ - ��� ������, � ������ ������� ��������� �� ���� ������
int [2][2] arr_2 = new int[3][3];{//������ ������ arr_2, ������[]-��� ����������
�����, ������[]- ��� ���������� �������� � ����� ������
{23,34,45}// ������ � ������ ������
{12,13,16}// ������ �� ������ ������
{56,78,91}// ������ � ������� ������
};
arr_2[1][1]=289// ����������� ������[1] ����� �� ������� �������[1],�
����������� ��� ����� �������� 289 ;
for(int r =0; r<3;r++){
for(int g=0; g<3:g++){
System.out.println(arr_2[r][g]);// ����� ���� ��������� �������
�������(������)
1)�� ���������� �������
public static void main(String[] args){// public-������ ��� ������
��������(�������� �� ����� ������), void- �������� ��� ������ ����������,
�� �������� ������� �� ������, (String[] args)-������ ��� ������ �������� �������
������� ����������, static - �������� ��� ������ ����������� ������������ ������
func(34, 56);// ������� �����, �� �������� � �������� � �������� �����(�����)
}
public static void fanc(int a, int b){// �������� ��� ���������� "fanc" ����
����� �����, a � b -��� ��������� ����������
}
2)���������� ������
public static void main(Strings[] args){
int tam = con(56;60);//������ ��������� tam, ������ ����� ����� �����������
������� ������� con;
System.out.println(tam);//������� ��������� ���������
}
public static int con(int a; int b);{// �������� ��� ���������� "con" ���� �����
�����, a � b -��� ��������� ����������
int res;// ����� ���� ���� ���������
res=a+b;// ������������ ��� �������� � ����� ��������� �� ���������� �������
��������
return res;// ���������� ���������
}
�������� ������� � ��������