Data Structure
 Networking
 RDBMS
 Operating System
 Java
 MS Excel
 iOS
 HTML
 CSS
 Android
 Python
 C Programming
 C++
 C#
 MongoDB
 MySQL
 Javascript
 PHP
- Selected Reading
 - UPSC IAS Exams Notes
 - Developer's Best Practices
 - Questions and Answers
 - Effective Resume Writing
 - HR Interview Questions
 - Computer Glossary
 - Who is Who
 
Programming Articles - Page 1887 of 3366
 
			
			1K+ Views
After an object has been used, it is deallocated from the memory using the Garbage Collector class. The objects are destroyed based on the fact that no reference to that object is present. The Garbage Collector class calls the ‘finalize’ function on the object that needs to be destroyed.What is island of isolation?When two objects ‘a’, and ‘b’ reference each other, and they are not referenced by any other object, it is known as island of isolation.It is a group of objects which reference each other but they are not referenced but other objects of other applications at all.Note − ... Read More
 
			
			2K+ Views
Array is considered to be an object in Java. The reason behind this is that an array can be created using the ‘new’ keyword. The ‘new’ keyword/operator is always used to create an object. This is how an array is perceived as an object.The direct parent class or super class of any array is the ‘Object’ class. Every array type in Java belongs to a certain class. This indicates that there are explicit classes for integer array types, float array types, double array types, and so on.Arrays can be dynamically created, and be assigned variables as well.Let us see an ... Read More
 
			
			334 Views
IntUnaryOperator Interface, a functional interface of Java that performs an operation on a single integer-valued operand and also returns an integer value as a result. Since it is a functional interface, we can use it as an assignment target for the lambda expressions or method references. Here, the functional interface means an interface that contains only a single abstract method and exhibits single functionality. Some examples of functional interfaces are Predicate, Runnable, and Comparable interfaces. The IntUnaryOperator interface is defined in the 'java.util.function' package. In this article, we are going to explore the IntUnaryOperator Interface and its built-in methods with ... Read More
 
			
			318 Views
String interning is a process wherein a single copy of every distinct string value is stored. In addition to this, the strings can’t be changed too. This way, strings can contain the same data as well as share the same memory. This way, the memory required would be greatly reduced.When the ‘intern’ function is called −It checks the equality between two strings- whether the string object is present in the String Constant pool (SCP) or not.If available, the string is returned by fetching it from the pool. Otherwise, a new String object is created and added to the pool. A ... Read More
 
			
			6K+ Views
Set data structure is used to store unique values only, meaning no duplicate values would be stored in a set. When a HashSet is created, it internally implements a HashMap. An element can be inserted into the HashSet using the ‘add’ function. This internally calls the ‘put’ function since a HashMap would have been internally created. Hence, Set takes in unique values with the help of HashMap.HashMap contains unique key and value pairs, wherein the key and value pairs are inserted using the ‘put’ function. Upon calling the ‘put’ function, a previous value associated with the key or null is ... Read More
 
			
			2K+ Views
The function ‘hashCode’ is used to get the hash code of an object in Java. This is an object of super class Object. It returns the object reference’s memory as an integer. It is a native function, which means no direct method in Java can be used to fetch the reference of the object.For better performace of HashMap, use the hashCode() properly. Basically, this function is used to calculate the bucket and index values. It is defined in the following way −public native hashCode()Since we have mentioned ‘bucket’, it is important to understand what it means. It is an element ... Read More
 
			
			199 Views
There are many facts associated with null in Java. We will discuss a few of them here with examples −The default value of any reference variable in Java is always null.Example Live Demopublic class Demo{ private static Object my_obj; public static void main(String args[]){ System.out.println("The default value of object my_obj is : " + my_obj); } }OutputThe default value of object my_obj is : nullA class named Demo defines a static object and the main function that shows the default value of this pre-defined object.The not equal to (!=) and comparison (==) operators can be ... Read More
 
			
			448 Views
Java was built by sheer accident, a team of developers were busy building a set top box, and began cleaning C++. When they were winding up these changes, they ended up discovering Java and its runtime environment.Many of you might be aware of this, but for those who aren’t, Java wasn’t the original name that was decided for this language. It was ‘Oak’. Sun Marketing system changed the name later when they realized that a company named ‘Oak’ existed.It is a widely used language all over the world, and is considered to be a favourite amongst the developer group, and ... Read More
 
			
			208 Views
There are many interesting facts with respect to increment and decrement operators in Java. We will discuss a few of them with examples −The increment and decrement operators can’t be used with the ‘final’ variables. This is due to the fact that variables associated with ‘final’ keyword can’t be changed −Example Live Demopublic class Demo{ public static void main(String[] args){ final int my_val = 34; int my_val_2 = ++my_val; System.out.println("The value is :"); System.out.println(my_val_2); } }Output/Demo.java:6: error: cannot assign a value to final variable my_val int my_val_2 ... Read More
 
			
			199 Views
There are many facts with respect to array assignment, and we will discuss a few of them with working examples here −While creating array object type, the element that would be present inside the array can be declared as type objects or as child class’s object.Example Live Demopublic class Demo{ public static void main(String[] args){ Number[] my_val = new Number[3]; my_val[0] = new Integer(91); my_val[1] = new Double(65.963); my_val[2] = new Double(45.7965); System.out.println(my_val[0]); System.out.println(my_val[1]); System.out.println(my_val[2]); } }Output91 65.963 ... Read More