Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Aphorismen
Applications
Business Economics & Admin.
My Computers
Cooking
Devices
Folders
Food
Hardware
Infos
Software Development
Sports
Operation Instructions
Todos
Test
Help
Glossary
Community portal
adaptions
Sidebar anpassen
Wiki RB4
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
JavaAPI
(section)
Page
Discussion
English
Read
Edit
View history
Toolbox
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==API Classes== ===Class ‘Class’=== Java always maintains what is called run-time type information. You can access this information by working with the class Class and calling <Object>.getClass() or by <Object>.class. The class Class contains the following methods: {| border=1 cellpadding=2 cellspacing=0 |- | |forName(String ClassName) | |- | |Method getDeclaredMethod( |} <MethodName>,\\\\<ArrayOfArgumentClasses>)|{| border=1 cellpadding=2 cellspacing=0 |- | |getInterface() | |- | |getName() | |- | |getSuperClass() | |- | |isArray() | |- | | | |- | |newInstance() |this calls only the default ctor |- | |isInterface() | |- | |toString() | |} Interfaces are also stored in Class objects. An object can also be created by a call to the newlnstance method of class Class, which performs these steps: *A new object is created of the type represented by the class object for which the newlnstance method was invoked. As the new object is created, all its instance variables are initialized to their standard default values (§ Standard Default Values). *The constructor for the newly created object is invoked with no actual arguments. *After the constructor has returned, a reference to the newly created and initialized object is returned as the value of the call to the newlnstance method. The compile-time type of this reference will be Object, which is the declared return type of the newlnstance method, but its run-time type will be the type represented by the class object for which the newlnstance method was invoked. ===Class 'Exception=== * getMessage() ===Class ‘Object’=== Every java class extends Object but you don’t have to write '''class''' <ClassName> '''extends Object''' Your classes may want to override the following Object methods: {| border=1 cellpadding=2 cellspacing=0 |- |'''protected clone()''' |The JVM requires classes to implement the java.lang.Cloneable interface to explicitly declare an object to have the capability to be cloned. The Object.clone() method will create a shallow copy of the current object, that is only the primitives and reference values are copied, so sharing all referenced objects. Um ein Objekt zu kreieren sollte nie ein ctor verwendet werden sondern super.clone() (s. [24] page 70). |- |'''equals(Object o)''' |This method checks if some other object passed to it as an argument is equal to the object on which this method is invoked. In der Standardimplementierung von Object wird nur verglichen ob zwei zu vergleichende Objektereferenzen auf das gleiche physikalische Objekt zeigen, d.h. if a == b. This particular comparison is also known as "shallow comparison". The classes providing their own implementations of the equals method are supposed to perform a "deep comparison". The JDK 1.4 says the implementation must be reflexive, symmetric, transitive and consistent. The overwritten method must have a parameter of type object, otherwise it's overloading, not overwriting. |- |'''finalize()''' | |- |'''getClass()''' | |- |'''hashCode()''' |This method returns the hash code value for the object on which this method is invoked. This method returns the hash code value as an integer and is supported for the benefit of hashing based collection classes such as Hashtable, HashMap, HashSet etc. This method must be overridden in every class that overrides the equals method. Equal objects must produce the same hash code as long as they are equal, however unequal objects need not produce distinct hash codes. |- |'''final notify()''' |removes one thread by random from the waiting list of this object. |- |'''final notifyAll()''' |removes all threads waiting for this object from the waiting list |- |'''String toString()''' | |- |'''wait()''' |calling wait() causes the thread to release control of the object's lock, which means that other threads are able to obtain the monitor for this object. |}
Summary:
Please note that all contributions to Wiki RB4 may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Uwe Heuer Wiki New:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Toggle limited content width