
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

368 Views
Java is a high-level programming language originally developed by Sun Microsystems and released in 1995. Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX. .NET framework is a computer software framework invented by Microsoft. It runs on Microsoft Windows OS (Operating Systems). It provides user interface, data access, database connectivity, cryptography, web application development, etc. Languages Java supports only Java patterns. .NET supports multiple languages such as VB.NET, C#, F#, etc. Platforms Java is platform independent and it can run on Windows, Linux and Mac OS. .NET works on Windows. Runtime ... Read More

793 Views
The standard Java API and virtual machine are mainly designed for desktop as well as server systems. They are not that compatible with mobile devices. Because of this, Google has created a different API and virtual machine for mobile devices. This is known as the Dalvik virtual machine.The Dalvik virtual machine is a key component of the Android runtime and is a part of JVM (Java Virtual Machine) developed specially for Android. The Dalvik virtual machine uses features that are quite important in Java such as memory management, multi-threading etc. The programs in Java are first converted into JVM and ... Read More

4K+ Views
This articles covers how to encode and decode JSON objects using Java programming language. Let's start with preparing the environment to start our programming with Java for JSON.EnvironmentBefore you start with encoding and decoding JSON using Java, you need to install any of the JSON modules available. For this tutorial we have downloaded and installed JSON.simple and have added the location of json-simple-1.1.1.jar file to the environment variable CLASSPATH.Mapping between JSON and Java entitiesJSON.simple maps entities from the left side to the right side while decoding or parsing, and maps entities from the right to the left while encoding.JSONJavastringjava.lang.Stringnumberjava.lang.Numbertrue|falsejava.lang.Booleannullnullarrayjava.util.Listobjectjava.util.MapOn decoding, ... Read More

4K+ Views
This articles covers how to encode and decode JSON objects using Java programming language. Let's start with preparing the environment to start our programming with Java for JSON.EnvironmentBefore you start with encoding and decoding JSON using Java, you need to install any of the JSON modules available. For this tutorial we have downloaded and installed JSON.simple and have added the location of json-simple-1.1.1.jar file to the environment variable CLASSPATH.Mapping between JSON and Java entitiesJSON.simple maps entities from the left side to the right side while decoding or parsing, and maps entities from the right to the left while encoding.JSONJavastringjava.lang.Stringnumberjava.lang.Numbertrue|falsejava.lang.Booleannullnullarrayjava.util.Listobjectjava.util.MapOn decoding, ... Read More

360 Views
java.lang.System.currentTimeMillis() method can be used to compute the time taken by a function in java. Trick is simple. Get the before time and after time using currentTimeMillis() where before time is the time when method is invoked and after time is when method has executed. See the example below −Example Live Demopublic class Tester{ public static void main(String[] args) { long startTime = System.currentTimeMillis(); longRunningMethod(); long endTime = System.currentTimeMillis(); System.out.println("Time taken: " + (endTime -startTime) + " ms"); } private static void longRunningMethod() { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } }OutputTime taken: 1000 ms

360 Views
java.lang.System.currentTimeMillis() method can be used to compute the time taken by a function in java. Trick is simple. Get the before time and after time using currentTimeMillis() where before time is the time when method is invoked and after time is when method has executed. See the example below −Example Live Demopublic class Tester{ public static void main(String[] args) { long startTime = System.currentTimeMillis(); longRunningMethod(); long endTime = System.currentTimeMillis(); System.out.println("Time taken: " + (endTime -startTime) + " ms"); } private static void longRunningMethod() { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } }OutputTime taken: 1000 ms

14K+ Views
Arrays can be compared using following ways in JavaUsing Arrays.equals(array1, array2) methods − This method iterates over each value of an array and compare using equals method.Using Arrays.deepEquals(array1, array2) methods − This method iterates over each value of an array and deep compare using any overridden equals method.Using == on array will not give the desired result and it will compare them as objects. See the example below for each of the comparison way.Example Live Demoimport java.util.Arrays; public class Tester{ public static void main(String[] args) { int[] array1 = {1, 2, 3}; int[] ... Read More

14K+ Views
Arrays can be compared using following ways in JavaUsing Arrays.equals(array1, array2) methods − This method iterates over each value of an array and compare using equals method.Using Arrays.deepEquals(array1, array2) methods − This method iterates over each value of an array and deep compare using any overridden equals method.Using == on array will not give the desired result and it will compare them as objects. See the example below for each of the comparison way.Example Live Demoimport java.util.Arrays; public class Tester{ public static void main(String[] args) { int[] array1 = {1, 2, 3}; int[] ... Read More

245 Views
Java Garbage collector tracks the live object and objects which are no more need are marked for garbage collection. It relieves developers to think of memory allocation/deallocation issues. JVM uses the heap, for dynamic allocation. In most of the cases, the operating systems allocate the heap in advance which is then to be managed by the JVM while the program is running. It helps in following ways: Faster object creation as Operating system level synchronization is no more needed for each object. Object Allocation takes some memory and increases the offset. When an object is not required, garbage collector ... Read More

245 Views
Java Garbage collector tracks the live object and objects which are no more need are marked for garbage collection. It relieves developers to think of memory allocation/deallocation issues. JVM uses the heap, for dynamic allocation. In most of the cases, the operating systems allocate the heap in advance which is then to be managed by the JVM while the program is running. It helps in following ways: Faster object creation as Operating system level synchronization is no more needed for each object. Object Allocation takes some memory and increases the offset. When an object is not required, garbage collector ... Read More