„Java Platform, Standard Edition” változatai közötti eltérés
[ellenőrzött változat] | [ellenőrzött változat] |
Tartalom törölve Tartalom hozzáadva
a clean up, replaced: – → – (28), — → — (3) AWB |
|||
24. sor:
A főbb osztályok a {{Javadoc:SE|package=java.lang|java/lang}} csomagban a következők:
* {{Javadoc:SE|java/lang|Object}}
* {{Javadoc:SE|java/lang|Enum}}
* {{Javadoc:SE|java/lang|Class}}
* {{Javadoc:SE|java/lang|Throwable}}
* {{Javadoc:SE|java/lang|Error}}, {{Javadoc:SE|java/lang|Exception}}, és {{Javadoc:SE|java/lang|RuntimeException}}
* {{Javadoc:SE|java/lang|Thread}}
* {{Javadoc:SE|java/lang|String}}
* {{Javadoc:SE|java/lang|StringBuffer}} és {{Javadoc:SE|java/lang|StringBuilder}}
* {{Javadoc:SE|java/lang|Comparable}}
* {{Javadoc:SE|java/lang|Iterable}}
* {{Javadoc:SE|java/lang|ClassLoader}}, {{Javadoc:SE|java/lang|Process}}, {{Javadoc:SE|java/lang|Runtime}},{{Javadoc:SE|java/lang|SecurityManager}}, és {{Javadoc:SE|java/lang|System}}
* {{Javadoc:SE|java/lang|Math}} és {{Javadoc:SE|java/lang|StrictMath}}
* A [[primitív csomagoló osztály]]ok, melyek osztályokba csomagolják az [[primitív típus]]okat mint pl. <code>int</code>-be.
* Alap kivétel osztályokat dob a nyelvi szinten, továbbá más közös kivételeket is.
45. sor:
The {{Javadoc:SE|package=java.lang.ref|java/lang/ref}} package provides more flexible types of [[Reference (computer science)|references]] than are otherwise available, permitting limited interaction between the application and the [[Java Virtual Machine]] (JVM) [[garbage collection (computer science)|garbage collector]]. It is an important package, central enough to the language for the language designers to give it a name that starts with "java.lang", but it is somewhat special-purpose and not used by a lot of developers. This package was added in J2SE 1.2.
Java has an expressive system of references and allows for special behavior for garbage collection. A normal reference in Java is known as a "strong reference." The <code>java.lang.ref</code> package defines three other types of references
*A {{Javadoc:SE|java/lang/ref|SoftReference}} can be used to implement a [[cache (computing)|cache]]. An object that is not reachable by a strong reference (that is, not strongly reachable), but is referenced by a soft reference is called "softly reachable." A softly reachable object may be garbage collected at the discretion of the garbage collector. This generally means that softly reachable objects will only be garbage collected when free memory is low, but again, it is at the discretion of the garbage collector. Semantically, a soft reference means "keep this object when nothing else references it unless the memory is needed."
71. sor:
====== Discovery ======
Discovery typically starts with an object and calling the {{Javadoc:SE|java/lang|Object|getClass()}} method to get the object's <code>Class</code>. The <code>Class</code> object has several methods for discovering the contents of the class, for example:
* {{Javadoc:SE|name=getMethods()|java/lang|Class|getMethods()}}
* {{Javadoc:SE|name=getConstructors()|java/lang|Class|getConstructors()}}
* {{Javadoc:SE|name=getFields()|java/lang|Class|getFields()}}
* {{Javadoc:SE|name=getClasses()|java/lang|Class|getClasses()}}
* {{Javadoc:SE|name=getSuperclass()|java/lang|Class|getSuperclass()}}
* {{Javadoc:SE|name=getInterfaces()|java/lang|Class|getInterfaces()}}
====== Use by name ======
The <code>Class</code> object can be obtained either through discovery, by using the ''class literal'' (e.g. <code>MyClass.class</code>) or by using the name of the class (e.g. {{Javadoc:SE|name=Class.forName("mypackage.MyClass")|java/lang|Class|forName(java.lang.String)}}). With a <code>Class</code> object, member <code>Method</code>, <code>Constructor</code>, or <code>Field</code> objects can be obtained using the symbolic name of the member. For example:
* {{Javadoc:SE|name=getMethod("methodName", Class...)|java/lang|Class|getMethod(java.lang.String,java.lang.Class...)}}
* {{Javadoc:SE|name=getConstructor(Class...)|java/lang|Class|getConstructor(java.lang.Class...)}}
* {{Javadoc:SE|name=getField("fieldName")|java/lang|Class|getField(java.lang.String)}}
<code>Method</code>, <code>Constructor</code>, and <code>Field</code> objects can be used to dynamically access the represented member of the class. For example:
* {{Javadoc:SE|name=Field.get(Object)|java/lang/reflect|Field|get(java.lang.Object)}}
* {{Javadoc:SE|name=Method.invoke(Object, Object...)|java/lang/reflect|Method|invoke(java.lang.Object,%20java.lang.Object...)}}
* {{Javadoc:SE|name=Constructor.newInstance(Object...)|java/lang/reflect|Constructor|newInstance(java.lang.Object...)}}
===== Arrays and proxies =====
The <code>java.lang.reflect</code> package also provides an {{Javadoc:SE|java/lang/reflect|Array}} class that contains static methods for creating and manipulating array objects, and since J2SE 1.3, a {{Javadoc:SE|java/lang/reflect|Proxy}} class that supports dynamic creation of proxy classes that implement specified interfaces.
The implementation of a <code>Proxy</code> class is provided by a supplied object that implements the {{Javadoc:SE|java/lang/reflect|InvocationHandler}} interface. The <code>InvocationHandler</code>'s {{Javadoc:SE|name=invoke(Object, Method, Object<nowiki>[]</nowiki>)|java/lang/reflect|InvocationHandler|invoke(java.lang.Object,java.lang.reflect.Method,java.lang.Object<nowiki>[]</nowiki>)}} method is called for each method invoked on the proxy
=== java.io ===
132. sor:
Data type handling and processing or filtering of stream data is accomplished through stream [[filter (software)|filters]]. The filter classes all accept another compatible stream object as a parameter to the constructor and ''decorate'' the enclosed stream with additional features. Filters are created by extending one of the base filter classes {{Javadoc:SE|java/io|FilterInputStream}}, {{Javadoc:SE|java/io|FilterOutputStream}}, {{Javadoc:SE|java/io|FilterReader}}, or {{Javadoc:SE|java/io|FilterWriter}}.
The <code>Reader</code> and <code>Writer</code> classes are really just byte streams with additional processing performed on the data stream to convert the bytes to characters. They use the default [[character encoding]] for the platform, which as of J2SE 5.0 is represented by the {{Javadoc:SE|java/nio/charset|Charset}} returned by the {{Javadoc:SE|package=java.nio.charset|java/nio/charset|Charset|defaultCharset()}} static method. The {{Javadoc:SE|java/io|InputStreamReader}} class converts an <code>InputStream</code> to a <code>Reader</code> and the {{Javadoc:SE|java/io|OutputStreamWriter}} class converts an <code>OutputStream</code> to a <code>Writer</code>. Both these classes have constructors that allow the character encoding to use to be
The following table shows the other processes and filters supported directly by the <code>java.io</code> package. All of these classes extend the corresponding <code>Filter</code> class.
171. sor:
The {{Javadoc:SE|package=java.math|java/math}} package supports [[Arbitrary-precision arithmetic|multiprecision arithmetic]] (including modular arithmetic operations) and provides multiprecision prime number generators used for cryptographic key generation. The main classes of the package are:
* {{Javadoc:SE|java/math|BigDecimal}}
* {{Javadoc:SE|java/math|BigInteger}}
* {{Javadoc:SE|java/math|MathContext}}
* {{Javadoc:SE|java/math|RoundingMode}}
=== java.net ===
|