Primitive type - Java

Explain why we don’t need to use new for variables of the primitive types, such as int or float

The key word ‘new’ is used for creation of objects. Primitive types are to use constants but not objects. Hence, new key word is not used for primitive variables.
What is finalize()? Is finalize() similar to a destructor? - Java
The finalize() method of java is invoked by JVM to reclaim the inaccessible memory location, When the ‘orphan’ object (without reference) is to be released, JVM invokes the finalize() method...
Why does String define the equals( ) method? - Java
The equals() method is defined in String class in order to test whether two strings values are same sequence of characters...
String objects are immutable in java
A string object that is created using “String” class is immutable. The characters of the object can not be changed / modified. There are some methods, such as split(), substring(), beginsWith() etc...
Post your comment