0% found this document useful (0 votes)
37 views

Video and Material - Programming in Java Materials - Programming in Java 41668851319447

- The Object class is the parent class of all classes in Java and contains common methods like getClass(), hashCode(), equals(), clone(), toString(), notify(), notifyAll(), wait() that are inherited by all other classes. - The getClass() method returns the Class object of the current object. hashCode() returns a hashcode for the object. equals() compares the current object to another. clone() creates a copy of the object. - The wait(), notify() and notifyAll() methods are used to pause/resume threads waiting on an object's monitor. wait() causes a thread to wait until another thread invokes notify() or notifyAll().

Uploaded by

Kabilesh Cm
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Video and Material - Programming in Java Materials - Programming in Java 41668851319447

- The Object class is the parent class of all classes in Java and contains common methods like getClass(), hashCode(), equals(), clone(), toString(), notify(), notifyAll(), wait() that are inherited by all other classes. - The getClass() method returns the Class object of the current object. hashCode() returns a hashcode for the object. equals() compares the current object to another. clone() creates a copy of the object. - The wait(), notify() and notifyAll() methods are used to pause/resume threads waiting on an object's monitor. wait() causes a thread to wait until another thread invokes notify() or notifyAll().

Uploaded by

Kabilesh Cm
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

-‎ public final Class getClass()returns the Class

‎class object of this object. The Class class


‎can further be used to get the metadata of
‎this class.
‎-public int hashCode()returns the hashcode
‎number for this object.public boolean equals(
i‎s a process of executing multiple threads ‎Object obj)compares the given object to this
‎simultaneously. ‎object.
‎ ‎Multithreading ‎-protected Object clone() throws
‎thread is a lightweight sub-process, the ‎CloneNotSupportedExceptioncreates and
‎smallest unit of processing ‎returns the exact copy (clone) of this object.
‎-public String toString()returns the string
‎representation of this object.
‎-public final void notify()wakes up single
‎ ypes of Exception:
T
‎thread, waiting on this object's monitor.

‎-public final void notifyAll()wakes up all the
‎Checked Exception. --directly inherit the
‎ he Object class is the parent class of all the
T ‎ ethods of Object class
M ‎threads, waiting on this object's monitor.
‎Throwable class except RuntimeException
‎and Error are known as checked exceptions.
‎Object class ‎classes in java by default. In other words, it is ‎ ‎-public final void wait(long timeout)throws
‎the topmost class of java. ‎ ‎InterruptedExceptioncauses the current
‎For example, IOException, SQLException,
‎thread to wait for the specified milliseconds,
‎etc. Checked exceptions are checked at
‎until another thread notifies (invokes notify()
‎compile-time.
‎ eywords:
K ‎or notifyAll() method).

‎ ‎-public final void wait(long timeout,int nanos)
‎Unchecked Exception--that inherit the
‎try ‎throws InterruptedExceptioncauses the
‎RuntimeException are known as unchecked i‎s one of the powerful mechanism to handle
‎catch ‎current thread to wait for the specified
‎finally
‎exceptions. For example, ‎the runtime errors so that the normal flow of ‎Exception Handling ‎milliseconds and nanoseconds, until another
‎ArithmeticException, NullPointerException, ‎the application can be maintained.
‎throw ‎thread notifies (invokes notify() or notifyAll()
‎ArrayIndexOutOfBoundsException, etc.
‎throws ‎method).
‎Unchecked exceptions are not checked at
‎ ‎-public final void wait()throws
‎compile-time, but they are checked at
‎runtime.

‎Programming in java ‎InterruptedExceptioncauses the current
‎thread to wait, until another thread notifies (
‎invokes notify() or notifyAll() method).
‎Error --Error is irrecoverable. Some example
‎of errors are OutOfMemoryError,
‎ ‎-protected void finalize()throws Throwableis
‎invoked by the garbage collector before
‎VirtualMachineError, AssertionError etc.
‎object is being garbage collected.

i‎t is a way to create exact copy of an object. j‎ava.lang.Cloneable interface must be


‎ here is only call by value in java, not call by
T
‎object clone ‎The clone() method of Object class is used to ‎implemented by the class whose object
‎clone an object. ‎clone we want to create
‎reference. If we call a method passing a ‎call by value
‎value, it is known as call by value.

t‎ o work on math calculations like min(),


i‎s a process in which a method calls itself
‎Math class ‎max(), avg(), sin(), cos(), tan(), round(), ceil(),
‎continuously
‎Recursion ‎floor(), abs() etc.

‎ oolean-Boolean
b
‎char-Character
‎byte-Byte
‎short-Short t‎ ypes:
t‎ o convert primitive into object and object
‎-intInteger ‎- Autoboxing
‎into primitive.
‎Wrapper class
‎long-Long ‎-Unboxing
‎float-Float
‎double-Double

You might also like