filmov
tv
Java Tutorial | Object, Math, StringBuilder, StringBuffer, Runtime and ProcessBuilder Classes

Показать описание
Java Math class provides several methods to work on math calculations
The differences between String, StringBuffer, and StringBuilder are based on the following two parameters:
Mutability
Performance
StringBuffer performance is slower when compared to StringBuilder
Java toString() Method
The toString() method returns the String representation of the object.
If you print any object, Java compiler internally invokes the toString() method on the object. So overriding the toString() method, returns the desired output.
Note: Default behavior of toString() is to print class name, then @, then unsigned hexadecimal representation of the hash code of the object.
The equals() method checks whether two objects are equal.
equals() Return Values:
returns true if two objects are equal
returns false if two objects are not equal
Note: In Java, if two reference variables refer to the same object, then the two reference variables are equal to each other.
What is meant by hashCode in Java?
hashCode in Java is a function that returns the hashcode value of an object on calling. It returns an integer value which is generated by the hashing algorithm. The process of assigning a unique value to an object or attribute using an algorithm, which enables quicker access, is known as hashing.
hashCode in Java helps the program to run faster. For example, comparing two objects by their hashcodes will give the result 20 times faster than comparing them using the equals() function.
Java Runtime class
The exec method(executes given command in a separate process.) invoked by the Runtime instance returns a reference to this class instance.
If this video is useful to you, please like and share If you didn't subscribe kindly subscribe. So that you will get a notification about my new videos
#ARIVU_INFO
The differences between String, StringBuffer, and StringBuilder are based on the following two parameters:
Mutability
Performance
StringBuffer performance is slower when compared to StringBuilder
Java toString() Method
The toString() method returns the String representation of the object.
If you print any object, Java compiler internally invokes the toString() method on the object. So overriding the toString() method, returns the desired output.
Note: Default behavior of toString() is to print class name, then @, then unsigned hexadecimal representation of the hash code of the object.
The equals() method checks whether two objects are equal.
equals() Return Values:
returns true if two objects are equal
returns false if two objects are not equal
Note: In Java, if two reference variables refer to the same object, then the two reference variables are equal to each other.
What is meant by hashCode in Java?
hashCode in Java is a function that returns the hashcode value of an object on calling. It returns an integer value which is generated by the hashing algorithm. The process of assigning a unique value to an object or attribute using an algorithm, which enables quicker access, is known as hashing.
hashCode in Java helps the program to run faster. For example, comparing two objects by their hashcodes will give the result 20 times faster than comparing them using the equals() function.
Java Runtime class
The exec method(executes given command in a separate process.) invoked by the Runtime instance returns a reference to this class instance.
If this video is useful to you, please like and share If you didn't subscribe kindly subscribe. So that you will get a notification about my new videos
#ARIVU_INFO