មេរៀនទី២៧: Object class
មេរៀនទី២៧: Object class
Object class គឺជា parent class នៃ classes ទាំងអស់នៅក្នុង java bydefault។
ឧទាហរណ៍ getObject() method ដែលត្រឡប់ object ប្រភេទផ្សេងទៀតដូចជា Employee,Student etc, យើងអាចប្រើ Object class reference ឧទាហរណ៍:
Object obj=getObject();//

Methods នៃ Object class
Object class ផ្តល់ methods ជាច្រើនដូចខាងក្រោម: |
Method
ការអធិប្បាយ
|
|
public final ClassgetClass() | ត្រឡប់ចូល Class class object នៃ object នេះ។ |
public int hashCode() | ត្រឡប់ចូល hashcode នៃ object នេះ |
public boolean equals(Object obj) | ប្រៀបធៀប object បានផ្តល់អោយទៅ object នេះ |
protected Object clone() throws CloneNotSupportedException | បង្កើតនិងត្រឡប់ចូល object នេះ។ |
public String toString() | ត្រឡប់ string នៃ object នេះ។ |
public final void notify() | រង់ចាំ object ត្រួតពិនិត្យ |
public final void notifyAll() | រង់ចាំ object ត្រួតពិនិត្យចុងក្រោយ។ |
public final void wait(long timeout)throws InterruptedException | ដើម្បីរងចាំ milliseconds, (invokes notify() or notifyAll() method). |
public final void wait(long timeout,int nanos)throws InterruptedException | ដើម្បីរងចាំ miliseconds និង nanoseconds, រហូត (invokes notify() or notifyAll() method). |
public final void wait()throws InterruptedException | ដើម្បីរងចាំ ផ្សេងទៀត (invokes notify() or notifyAll() method)។ |
Post a Comment