�����:   ������:




�������
��������
�����
�����


Java
- �������
- ������-�����
- ������
- �������
- �����������
- ������
- IDE
- ������� ��������
- �������

��������� Java
- ����
- �������
- ������
- WAP, WML � ��.

JavaScript
- ������-�����
- �������
- ������

���-���������
- HTML
- CSS
- SSI

�������� ��� ���
�������
�����
������
���������
���� :)




Rambler's Top100

������������� Java programming������ 11-�

������������ ������� ��������!

����������

1. ����������
2. ���� "�� �����"
3. ������ - �����
4. ����������� ���
5. JavaScript

����������

�������

��� ���������� ���� ������� ������������ ���������� ������. � ����������� ���� ������ ����������� ���������� monthDays, ��� ������� - "������ ����� ����� ���� int".


int monthDays [];

��� ����, ����� ��������������� ������ ��� ������, ������������ ����������� �������� new. � ����������� ���� ������ ���� � ������� ��������� new ������� monthDdays ���������� ������ ��� �������� ���������� ����� �����.


month_days = new int [12];

����, ������ monthDays - ��� ������ �� ���������� ����� �����. ���� �������� ������, � ������� ��������� ������, �������� �������� �������� ����� ���� � ������� ���� (�� �����������).


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

��������� ��������� ������� � Java ���������� � ����, ��� ��� ����� ���� � ������ - ��� monthDays[3].

������� ����������� ������������� ���������������� ������� ��������, �� ������ ������������ ������������� ���������� ������� �����. ������������� ������� ������������ ����� ������ ����������� �������� ���������, ����������� � �������� ������. ������� �������� ���� �� ����� �������� ��������� �������. ��� ����� ������� �������� ������ ����� ��������� ����� ������� ���������, ������� ��������� ��� �������� ��������, ��������� � ������ �������������.


class AutoMonthDays
{
 public static void main(String args[])
 {
  int monthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
  System.out.println("April has " + monthDays[3] + " days.");
 }
}

� ���������� ������ ���� ���������, �� �������� ����� ����� �� ���������, ��� � �� �� ����� ������� ���������������.

Java ������ ������ �� ���, ����� �� �������� �� �������� ��� �� ���������� �������� ��������, ����� �� ������� �������. ���� �� �� ����������� ������������ � �������� �������� ��������, ��������� �� ������� ������� - ������������� ����� ���� �����, ������� ������ ��� ����� ���������� ��������� � �������, �� �������� ��������� �� ������ ������� ����������.

����������� �������

�� ����� ����, ��������� ����������� �������� � 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]);
 }
}

�������� ��� ���������, �� �������� ��������� ���������:
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]);
 }
}

�������� ��� ���������, �� �������� ��������� ���������:
0 0 0 0
0 1 2 3
0 2 4 6
0 3 6 9

� ��������� ������ �� ���������� �������������� ���������.

���� "�� �����"

�������� �����!

���������� ����� �������� � 9-� ������.

������������� 178 �������.

����� ���� ��� ����� ���������?

Java 2D API (39 ������� - 21.91%)
JSP (22 ������� - 12.36%)
�������������� �������� (36 ������� - 20.22%)
������������� ���������� (24 ������� - 13.48%)
����� AWT (2 ������ - 1.12%)
����� JFC Swing (12 ������� - 6.74%)
������� ���������� (27 ������� - 15.17%)
�� ���� (16 ������� - 8.99%)

��� ����� �� �������������� �� Java?

������ ���� ��� (28 ������� - 15.73%)
��� ���� (9 ������� - 5.05%)
��� (49 ������� - 27.52%)
������ ���� (30 ������� - 16.85%)
������ �����(�) (62 ������ - 34.83%)

� ��������� ����� ����� ����������� ���� ������������ 15% ������, ��������� �� ���� ����� ����������� �� ���� �����������.

��������� � JAR-����� �������� �������

��� ���� ����� �����������, ��� �������� ������� ���������� � JAR-�����, ���������� �������������� ������� ����������� ������� ������� �� ������� ������������ - ���������� � ������� ��������� �����.

��� �������� �������� ������� � JAR-����� ���������� ����� ��� �����������.

  • ������� keytool. ������������ ��� ��������� ���� ��������� � ��������� ����� � �����������.
  • ������� jarsigner. ������������ ��� ����������������� ��������� �������� ������� � JAR-������ � ����������� ���������� �����������.

��� ��� �����������:

  1. ��������� ��������� ���� ������.
  2. �������� ���������� �� ��� ����.
  3. ������������ ���������� ��� ��������� �������� ������� � JAR-�����.

��������� ���� ������

��� ��������� ����� ���� ������ ����� ������������ ��������� �������:
keytool -genkey -alias testkey

� ���������� ���������� ���� ������� ����� ������� ����� ���� ������ ����������� � ���� ������ ��� ������ testkey. ��� ��� � ��� ���������:

��������� keytool ��������� ��������� ��������� ���������:

-v
- ������ ������ ��������� � �������� ���������.
-alias ���������
- ��������� (���) ������� ������������� ���� ����.
-keyalg ��������_�����
- �������� ���������� ����� ������� - ������ �� ��������� ��� �������� SHA1 with DSA � ��� ����� �� ��������� ���� �� ����������� �������� ���, ������ ����� ��� ��������� DSA �������� ���� ����� ���� �� 512 �� 1024 ���, �� ���� �� ������ ��������� MD5 with RSA �� ������� ����� -keyalg "RSA" ������� �������� ��� ����� -keyalg ������������� � ����� -sigalg - �������� ������� ������� ����� ����������� �� ��������� ��� ���������� jar-����� (��� �������� ���������� ���������).
-keysize �����_�����
- ������ ������������ ������ � �����.
-keypass ������
- ������ ��� ������� �����. ���� ������ �� ����� ������ � ��������� ������, ��������� ��������� ������ ��� �������� � ������ �������. ����� ������ ������ ���� �� ����� ����� ��������.
-keystore ���������
- ������������ ��������� ������.
-storepass ������
- ������ ������� � ��������� ������.
-validity valDays
- ���� �������� ������ �����������. �� ��������� ��� 180 ����, ����� ������� ������ ��� ������.

�� ��������� ������� keytool �������� �������� ���� � ����������� ���� �� ���������� X.509.v1.

�������� keytool -list �� ����� ���������� ���������� keystore:

��������� �����������

����� ��������� ����� ���� ������ ���������� ��������� ��������� ������� CSR(Certificate Signing Request). ���� ������ ���������� � ����� ��������� ������ ������������.

��� ��������� CSR ������� ������� ��������� �������:
keytool -certreq

��� ����� ���� ������ testkey ������� ����� ��������� ��������� �������:
keytool -certreq -alias testkey

��� ��������� CSR ������� ����������� ��������� ���������:

-v
- ������������� ������ ��������� ������� ���������.
-alias ���������
- ����������� ���������� ���� ������, ��� ������� ���������� �������� ����������. �� ��������� ����������� �������� mekey.
-sigalg ��������_���������
- ������� ������������� ��������� �������� �������.
-file csr_����
- ��� � ������������ �����, � ������� ���������� ������������ ������.
-keypass ������
- ������ ��� ������� � ������� �����.
-storepass ������
- ������ ������� � ��������� ������.
-keystore ���������
- ��� � ������������ ����� � ����� ������.

��������������� CSR-������ ���������� � ��������� ������ ������������. ����� ���������� ���� ����������� �������� � ������������� ����� �������� ��� ����� ����� ��������� ����������.

� ����� ������ �������������� �������� ���������� ���������� � ���� � ������� ��������� �������:
keytool -import

��������� ��������� ����� ���� ������� � ������ import:

-v
- ������������� ������ ��������� ������� ���������.
-alias ���������
- ��������� ������� �����, ������� ����� �������������� � ������ ������������.
-file ����-�����������
- ��� � ������������ �����, � ������� �������� ���������� ����������.

�������:
keytool -export -alias testkey -file ���_�����
���� �������� ������� ����������� ��� ���������� � ��������� ����. ��������� ���� ���������� ���� �����������, ������� ����� ������������ ����������� ���� JAR-������.

��������� � JAR-����� �������� ������� � ������� ������� jarsigner

������ ��������� �������� ������� � JAR-������ ������� jarsigner �������� ����� ��������� ����������� ����������� JAR-�������. ��� ����� ���������� ��������� � � ���������� -verify/

��� ����� �������:
jarsigner myJarFile.jar
������ ������������� ���������� ������ �� ��������� � ��������� ����� ������� � ���� myJarFile.jar, ������� �������� �������� ���� ������.

��� �������� JAR-������ ������������ ������ ������� testkey ������� ��������� �������:
jarsigner myJarFile.jar testkey

��� ���� ����� ���� myJarFile.jar ������� ������������ � ��������� ���������, ��������, � ���� mySignedJarFile.jar ������� �������:
jarsigner -signedjar mySignedJarFile.jar myJarFile.jar testkey.

������ - �����

���� �������� ��� �������� �������:

� ���� �������� ��������� ��������. ����� ��������� ����� (6 ������) � Java-���������� �������� Explorer 6.0 (� ���� ������������ ������� Windows XP Rus) �� ������������� Java-�������. � ���� �� ����� ������ � ���� ����� ��� Opera � Netscape �������������, Internet Explorer -���. ����������� ��� ������.
Alexander

��� �������! � Windows XP, ����� IE 6.0, � � ��� ��� APPLET ������������, ��� ������?
Nick

�����:
��������� � ���� � Windows XP ����������� ������ Microsoft �� ����������� � �������� ������ � ���������, ������ �� ����� ��������� �� ���������. ��������� 32-��������� ������ Microsoft VM ����� ����� �� ���-���� ����������. (http://go.microsoft.com/fwlink/?LinkId=284)

������:
��� ��������� JDK �� XP?
Nick

�����:
���������� JDK ��� XP ���� ��� ���, �� � �������� ����������� ���������� �� win2k b winNT.

������:
����������, ��� � JTable ���������� ������������� � ���������� ��� ������� ������� ������?

�����:
������� ��������� ������ � ������� "����������� ���"

����������� ���


import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
public class Frame1 extends JFrame
{
 JPanel contentPane;
 public Frame1()
 {
  enableEvents(AWTEvent.WINDOW_EVENT_MASK);
  try
  {
   init();
  }
  catch(Exception e)
  {
   e.printStackTrace();
  }
 }
 private void init() throws Exception
 {
  this.setSize(new Dimension(640, 300));
  this.setTitle("������ JTable");
  //������ �������� ��������
  String[] columnNames = {"������ �������", "������ �������", "������ �������"};
  //������ ����� �������
  Object[] [] dataTable = { 
  {"������ ������� ������ 1", "������ ������� ������ 1", "������ ������� ������ 1"},
  {"������ ������� ������ 2", "������ ������� ������ 2", "������ ������� ������ 2"},
  {"������ ������� ������ 3", "������ ������� ������ 3", "������ ������� ������ 3"},
  {"������ ������� ������ 4", "������ ������� ������ 4", "������ ������� ������ 4"},
  {"������ ������� ������ 5", "������ ������� ������ 5", "������ ������� ������ 5"},
  {"������ ������� ������ 6", "������ ������� ������ 6", "������ ������� ������ 6"},
  {"������ ������� ������ 7", "������ ������� ������ 7", "������ ������� ������ 7"},
  {"������ ������� ������ 8", "������ ������� ������ 8", "������ ������� ������ 8"},
                          };
  //������ �������
  JTable jTable1 = new JTable(dataTable, columnNames);
  //�������� ������ �������� �������
  jTable1.getColumnModel().getColumn(0).setPreferredWidth(200);
  jTable1.getColumnModel().getColumn(1).setPreferredWidth(140);
  jTable1.getColumnModel().getColumn(2).setPreferredWidth(280);
  //�������� ������ ����� �������
  jTable1.setRowHeight(0,10);
  jTable1.setRowHeight(1,15);
  jTable1.setRowHeight(2,20);
  jTable1.setRowHeight(3,25);
  jTable1.setRowHeight(4,30);
  jTable1.setRowHeight(5,35);
  jTable1.setRowHeight(6,40);
  jTable1.setRowHeight(7,45);
  //������ ������
  JPanel p=new JPanel();
  //��������� �� ������ �������
  p.add(jTable1);
  //������ � ���� ������� �������� �� �����
  this.getContentPane().add(p);
 }
 protected void processWindowEvent(WindowEvent e)
 {
  super.processWindowEvent(e);
  if (e.getID() == WindowEvent.WINDOW_CLOSING)
  {
   System.exit(0);
  }
 }
}

JavaScript

������:
��� � ���� ������������ select box ��� ������������� ����?

�����:
����������� ���� ������:


<form; name="navForm">
<select; name="menu" onChange = "self.location = document.navForm.menu[document.navForm.menu.selectedIndex].value;">
<option; value="home.html">�����
<option; value="links.html">������
<option; value="contact.html">���������� ����������
</select>
</form>

������� ���������� �� E-mail [email protected] � �������� "������ �� Java".

��� �������� � �����������.
���� �����.

����������� �� ��� �������� ����� ��� /subs/subs.html


�� ������
"Eclipse IDE. ��������� ����������"
���������>>
��������>>

����� � ��� �� �� ����� ���� ������ ������� ���.


[an error occurred while processing this directive]



Apache Struts 2.0.11
Apache MyFaces Trinidad Core 1.2.3.
Sun ��������� ��������� ���������� � Java ME �� Java SE
��������� �����!



������ 29-�
������ 28-�
������ 27-�
������ 26-�
������ 25-�
������ 24-�
������ 23-�
������ 22-�
������ 21-�
������ 20-�
������ 19-�
������ 18-�
������ 17-�
������ 16-�
������ 15-�
������ 14-�
������ 13-�
������ 12-�
������ 11-�
������ 10-�
������ 9-�
������ 8-�
������ 7-�
������ 6-�
������ 5-�
������ 4-�
������ 3-�
������ 2-�
������ 1-�