
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
Found 7442 Articles for Java

3K+ Views
A JSON is a lightweight, text-based and language-independent data exchange format. A JSON can represent two structured types like objects and arrays. We can decode a JSON object using JSONObject and JSONArray from json.simple API. A JSONObject works as a java.util.Map whereas JSONArray works as a java.util.List.In the below example, we can decode a JSON object.Exampleimport org.json.simple.*; import org.json.simple.parser.*; public class JSONDecodingTest { public static void main(String[] args) { JSONParser parser = new JSONParser(); String str = "[ 0 , {\"1\" : { \"2\" : {\"3\" : {\"4\" : [5, { \"6\" : { \"7\" : 8 } } ] } ... Read More

6K+ Views
As we know in Java these both methods are primarily used to display text from code to console. Both these methods are of PrintStream class and are called on static member 'out' of 'System' class which is a final type class.The following are the important differences between print() and println().Sr. No.Keyprint()println()1Implementationprint method is implemented as it prints the text on the console and the cursor remains at the end of the text at the console.On the other hand, println method is implemented as prints the text on the console and the cursor remains at the start of the next line ... Read More

7K+ Views
Both notify and notifyAll are the methods of thread class and used to provide notification for the thread.But there are some significant differences between both of these methods which we would discuss below.Following are the important differences between notify and notifyAll.Sr. No.KeynotifynotifyAll1NotificationIn case of multiThreading notify() method sends the notification to only one thread among the multiple waiting threads which are waiting for lock.While notifyAll() methods in the same context sends the notification to all waiting threads instead of single one thread.2Thread identificationAs in case of notify the notification is sent to single thread among the multiple waiting threads so ... Read More

2K+ Views
LinkedList and LinkedHashSet are two important classes of Java's Collection framework. They are used to store groups of items, but they work in different ways and have their own unique features. What is a LinkedList in Java? Java LinkedList is a linear data structure that is used to store the same type of elements. It is a part of the Java Collections Framework, and it implements the List as well as the Deque interfaces. It has a dynamic size, which means it can grow and shrink as needed. Example The following is an example of how we write code for ... Read More

626 Views
In collections, one of the main functional requirement is to get the number of elements which are get stored in our collection so that one can decide whether to put more elements in it or not. Also, the number of elements is also required for iteration of collection.As we know Array and Arraylist both are used to store elements but both have different defined methods in order to know the number of elements stored in it.The array has a length method that provides the number of elements can be stored or in simple words capacity of the Array. Also, the ... Read More

1K+ Views
As we know, both Java and JavaScript are programming languages and are used in application development. But there are significant differences between the languages, which we will discuss below. Java Java is a high-level language that is also a platform-independent language. It is mainly used in the development of web applications, mobile applications, games, etc. Java is a statically typed language, which means that the code must be checked for errors before it runs. JavaScript whereas JavaScript is a dynamically typed language, which means that the code is checked for errors while it runs. JavaScript is a client-server-side language, which ... Read More

26K+ Views
HashMap and HashSet both are one of the most important classes of Java Collection framework.Following are the important differences between HashMap and HashSet.Sr. No.KeyHashMapHashSet1ImplementationHashmap is the implementation of Map interface.Hashset on other hand is the implementation of set interface.2Internal implementationHashmap internally do not implements hashset or any set for its implementation.Hashset internally uses Hashmap for its implementation.3Storage of elementsHashMap Stores elements in form of key-value pair i.e each element has its corresponding key which is required for its retrieval during iteration.HashSet stores only objects no such key value pairs maintained.4Method to add elementPut method of hash map is used to ... Read More

3K+ Views
For the difference between definition and declaration, one should consider their literal meaning first which includes Declare means to announce or proclaim while Define means to describe some entity.The following are the important differences between the Definition and the Declaration.Sr. No.KeyDeclarationDefinition1ConceptThe concept of declaration includes informing the compiler about properties of the variable such as its name, type of value it holds and the initial value if any it takes.While the definition is basically the actual implementation and memory location of function and about memory for the variable is allocated during the definition of the variable.2Exception in CBoth declaration and ... Read More

1K+ Views
As we know java is a language that supports multi threading and on the basis of nature threads in java are classified into two types Daemon thread and User thread.The following are the important differences between Daemon Threads and User Threads.Sr. No.KeyDaemon ThreadsUser Threads1NatureDaemon thread is low in priority i.e JVM does not care much about these types of threads.User threads are recognized as high priority thread i.e. JVM will wait for any active user thread to get completed.2CPU availabilityIt is not guaranteed that Daemon thread always gets CPU usage whenever it requires due to its low priority.User thread always ... Read More

2K+ Views
Java provides two ways to append strings and make them one. These two methods are namely the concat() method and + operator to join strings together, but there are some important differences between how they work. The concat() method is a bit more specific and limited, while the + operator is more flexible. So, even though they do the same thing, understanding how and when to use each one can help in writing more efficient or cleaner code in Java. Concat() Vs + operator The following are the important differences between the concat method and the + operator. ... Read More