
- •Тема 3. Документация Java api. Создание и использование объектов
- •Тема 3. Документация Java api
- •Загрузка и установка Java
- •Компилятор;
- •Документация Java api
- •Объяснение класса Point и некоторых положений документации
- •Создание и использование объектов (операторы для работы с объектами класса) Оператор import
- •Оператор new
- •Оператор (.)
- •Вызов метода
Программирование на Java
(4 курс)
Тема 3. Документация Java api. Создание и использование объектов
Тема 3. Документация Java api
Загрузка и установка Java
Официальным разработчиком языка Java является фирма Sun Microsystems (официальный сайт http://java.sun.com).
Для того чтобы программировать на языке Java, необходимо установить на свой компьютер:
Компилятор;
оболочку времени выполнения (Java Runtime Environment, JRE) – это окружение, в котором работает Java-программа (т.к. Java-программы работают на виртуальной машине).
Эти компоненты входят в состав комплекта разработчика Java (Java Developers Kit, JDK) - пакета программ, который бесплатно распространяется фирмой Sun Microsystems.
Java находится в Интернете по адресу:
http://java.sun.com/javase/downloads/index.jsp
Можно изучить сайт компании Sun в поисках дополнительной информации, такой как документация к языку или обучающие программы.
Оболочки для программирования на Java третьих фирм
Многие фирмы - поставщики программного обеспечения (в частности, Borland, Microsof и Symantec) разрабатывают свои оболочки для программирования на Java. В состав этих оболочек включен графический интерфейс пользователя, который делает их более удобными в использовании в сравнении с JDK. Однако все эти продукты уже не являются бесплатными.
Оболочки для программирования на Java:
NetBeans – графическая оболочка от фирмы Sun Microsystems (свободно распространяемая);
VisualJ – графическая оболочка от фирмы MicroSoft;
JBuilder – графическая оболочка от фирмы Borland и др.
Мы работаем с JDK 1.5 (Java 5) и NetBeans.
Платформы Java:
Java SE – стандартная;
Java ЕE – для Internet и компьютерных сетей;
Java МE – для мобильных устройств.
Документация Java api
Полную документацию Java API (Java Application Programming Interface) можно найти в Интернете по адресу:
http://java.sun.eom/j2se/l.5.0/docs/api/.
Это лучший доступный справочник в тех ситуациях, когда у вас есть вопросы по программированию на языке Java.
|
JDKTM 5.0 Documentation |
|
Search General Info API & Language Guide to Features Tool Docs Demos/Tutorials |
J2SETM Platform at a Glance
This document covers the JavaTM 2 Platform Standard Edition 5.0 Development Kit (JDK 5.0). Its external version number is 5.0 and internal version number is 1.5.0. For information on a feature of the JDK, click on its component in the diagram below.
Search the Documentation |
Location |
Search the online documentation |
website |
New to the Java Platform?
See the New-to-JavaTM Programming Center. |
website |
General Information
Readme, Overview, Changes |
|
README |
website |
New Features and Enhancements |
docs |
Release Notes |
website |
|
|
Installation Instructions |
|
Installation Notes System Configurations |
website |
|
|
Compatibility |
|
|
|
Version Compatibility with Previous Releases |
website |
|
|
Bugs |
|
|
|
Fixed and Known Bugs |
website |
Submitting a Bug Report |
website |
|
|
Contacts |
|
|
|
Contacting Java Software |
docs |
|
|
Releases and Downloads |
|
|
|
JDK Download Page |
website |
Java Software Home Page |
website |
|
|
Legal Notices |
|
|
|
Documentation Redistribution Policy |
website |
Copyright and License Terms for Documentation |
docs |
API & Language Documentation
Java 2 Platform API Specification (NO FRAMES) |
docs |
|
|
Note About sun.* Packages |
website |
|
|
The Java Language Specification (DOWNLOAD) |
website |
|
|
The Java Virtual Machine Specification (DOWNLOAD) |
website |
Все классы сгруппированы в ПАКЕТЫ (аналог стандартных библиотек). Рассмотрим структуру информации о классе на примере класса Point (java.awt.Point).
java.awt Class Point
java.lang.Object
java.awt.geom.Point2D
java.awt.Point
All Implemented Interfaces:
Serializable, Cloneable
public class Point
extends Point2D
implements Serializable
A point representing a location in (x, y) coordinate space, specified in integer precision.
Since:
JDK1.0
See Also:
Serialized Form
Nested Class Summary |
Nested classes/interfaces inherited from class java.awt.geom.Point2D |
Point2D.Double, Point2D.Float |
Field Summary |
|
int |
x The x coordinate. |
int |
y The y coordinate. |
Constructor Summary |
|
Point() Constructs and initializes a point at the origin (0, 0) of the coordinate space. |
|
Point(int x, int y) Constructs and initializes a point at the specified (x, y) location in the coordinate space. |
|
Point(Point p) Constructs and initializes a point with the same location as the specified Point object. |
|
Method Summary |
|
boolean |
equals(Object obj) Determines whether or not two points are equal. |
Point |
getLocation() Returns the location of this point. |
double |
getX() Returns the X coordinate of the point in double precision. |
double |
getY() Returns the Y coordinate of the point in double precision. |
void |
move(int x, int y) Moves this point to the specified location in the (x, y) coordinate plane. |
void |
setLocation(double x, double y) Sets the location of this point to the specified double coordinates. |
void |
setLocation(int x, int y) Changes the point to have the specified location. |
void |
setLocation(Point p) Sets the location of the point to the specified location. |
String |
toString() Returns a string representation of this point and its location in the (x, y) coordinate space. |
void |
translate(int dx, int dy) Translates this point, at location (x, y), by dx along the x axis and dy along the y axis so that it now represents the point (x + dx, y + dy). |