
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

49K+ Views
A JSON array is an ordered collection of values that are enclosed in square brackets i.e., it begins with '[' and ends with ']'. The values in the arrays are separated by ', ' (comma).Sample JSON array{ "books": [ Java, JavaFX, Hbase, Cassandra, WebGL, JOGL] }The JSON-simple is a light weight library which is used to process JSON objects. Using this you can read or, write the contents of a JSON document using Java program.JSON-Simple maven dependencyFollowing is the maven dependency for the JSON-simple library − com.googlecode.json-simple json-simple ... Read More

64K+ Views
In this article, we will learn to write/create a JSON file using Java. JSON has become the standard for data exchange for any kind of application. Java also has a collection of libraries helpful in creating and storing JSON files. JSON JSON or JavaScript Object Notation is a lightweight text-based open standard designed for human-readable data interchange. Conventions used by JSON are known to programmers, which include C, C++, Java, Python, Perl, etc. Sample JSON document Below is an example of a JSON file: { "book": [ { ... Read More

60K+ Views
In this article, we will learn to read/parse a JSON array using Java. A JSON array is an ordered collection of values that are enclosed in square brackets, i.e., it begins with ‘[’ and ends with ‘]’. The values in the arrays are separated by ‘, ’ (comma). Sample JSON array The following is the syntax for JSON array initialization: { books": [ Java, JavaFX, Hbase, Cassandra, WebGL, JOGL] } Reading (Parsing) JSON array in Java The following are the different approaches for reading/parsing a JSON array in Java: JSON-Simple maven dependency ... Read More

10K+ Views
JSON or JavaScript Object Notation is a lightweight text-based open standard designed for human-readable data interchange. Conventions used by JSON are known to programmers and include C, C++, Java, Python, Perl, etc. Sample JSON document − { "book": [ { "id": "01", "language": "Java", "edition": "third", "author": "Herbert Schildt" ... Read More

2K+ Views
No, Java Swing components are not thread-safe in Java. This means that whenever Swing components should be accessed or changed, it is done mostly by using a single thread, the EDT. Why Swing Components are not thread-safe One of the main reasons Java Swing is not thread-safe is to simplify the task of extending its components. Another reason for that Java Swing is not thread-safe due to the overhead involved in obtaining and releasing locks and restoring the state. Below are some methods given by Swing for safe operation with its UI: SwingUtilities.invokeLater(): In ... Read More

33K+ Views
We can develop a login form in Java using Java Swing technology. In this example, we can create two labels username and password, two text fields for the user to enter valid credentials, and finally, one submit button. Once the user is able to enter the valid credentials in the two text fields, we can able to see Hello admin in the login form. Setting Up the Project We’ll use Java Swing, a GUI toolkit for building desktop applications. Required Libraries are: javax.swing.* (for Swing components) java.awt.* (for layout management) ... Read More

437 Views
In this article, we will learn how an IllegalStateException (unchecked) is thrown in Java. IllegalStateException is a subclass of RuntimeException. It occurs when a method is used at the wrong time or when an object is not in the right state. What is an IllegalStateException? An IllegalStateException is an unchecked exception in Java. This exception may arise in our Java program mostly if we are dealing with the collection framework of java.util.package. There are many collections, such as List, Queue, Tree, and Map, of which List and Queues (Queue and Deque) throw this IllegalStateException under particular conditions. When will ... Read More

10K+ Views
In Java, the exceptions are of two types: checked and unchecked exceptions. A checked exception is an exception that occurs at compile time; these are also called compile-time exceptions. An unchecked exception occurs at the time of execution. These are also called Runtime Exceptions. In this article, we will learn to create a custom unchecked exception in Java. We can create a custom unchecked exception by extending the RuntimeException class in Java. What are unchecked exceptions? The unchecked exceptions inherit from the Error class or the RuntimeException class. Many programmers feel that we cannot handle these exceptions in our programs because they represent the type of errors ... Read More

3K+ Views
A static method is the one which you can call without instantiating the class. If you want to call a static method of the superclass, you can call it directly using the class name.Example Live Demopublic class Sample{ public static void display(){ System.out.println("This is the static method........"); } public static void main(String args[]){ Sample.display(); } }OutputThis is the static method........It also works, if you call a static method using an instance. But, it is not recommended. Live Demopublic class Sample{ public static void display(){ System.out.println("This is the static ... Read More

3K+ Views
Inheritance can be defined as the process where one (parent/super) class acquires the properties (methods and fields) of another (child/sub). With the use of inheritance, the information is made manageable in a hierarchical order. The class which inherits the properties is known as a subclass and the class whose properties are inherited is called superclass. In short, in inheritance, you can access the members (variables and methods) of the superclass using the subclass object.Example Live Democlass SuperClass { public void display(){ System.out.println("Hello this is the method of the superclass"); } } public class SubClass extends SuperClass ... Read More