Raja has Published 760 Articles

JShell in Java 9?

raja

raja

Updated on 17-Feb-2020 05:05:11

134 Views

JShell is a new concept introduced in Java 9 version. It provides Java with REPL (Read-Eval-Print-Loop) ability. By using JShell, we can test the java-based logic and expressions without compiling it. REPL acts as an immediate feedback loop and has a great effect on productivity in that particular language.Step 1: Open Command Prompt ... Read More

Convert XML to POJO using the Jackson library in Java?

raja

raja

Updated on 14-Feb-2020 10:12:44

7K+ Views

The JSON Jackson is a library for Java. It has very powerful data binding capabilities and provides a framework to serialize custom java objects to JSON and deserialize JSON back to Java object. We can also convert an XML format to the POJO object using the readValue() method of the ... Read More

How to define the naming conventions for JSON field names in Java?

raja

raja

Updated on 14-Feb-2020 06:58:38

1K+ Views

The FieldNamingPolicy can be used to define a few standard naming conventions for JSON field names and it can be used in conjunction with GsonBuilder to configure a Gson instance to properly translate Java field names into the desired JSON field names. We can use the setFieldNamingPolicy() method of GsonBuilder to configure a specific naming policy ... Read More

What is the use of underscore keyword in Java 9?

raja

raja

Updated on 13-Feb-2020 10:29:35

1K+ Views

In earlier versions of Java, the underscore ("_") has used as an identifier or to create a variable name. Since Java 9, the underscore character is a reserved keyword and can't be used as an identifier or variable name. If we use a single underscore character as an identifier, the program ... Read More

Importance of a JSONTokener in Java?

raja

raja

Updated on 13-Feb-2020 10:12:30

2K+ Views

The JSONTokener class allows an application to break a string into tokens. It can be used by the JSONObject and JSONArray constructors to parse JSON source strings. A few important methods of JSONTokener class are back() - moves cursor one position back, more() - returns true if the token has element or else returns false, ... Read More

How to implement custom JSON de-serialization with Gson in Java?

raja

raja

Updated on 13-Feb-2020 10:11:34

522 Views

A Gson library provides a way to specify custom de-serializers by registering a custom de-serializer with the GsonBuilder if we need a way to convert a java object to JSON. We can create a custom de-serializer by overriding the deserialize() method of com.google.gson.JsonDeserializer class.In the below example, the implementation of custom de-serialization of ... Read More

How to validate if JTable has an empty cell in Java?

raja

raja

Updated on 12-Feb-2020 08:03:55

1K+ Views

A JTable is a subclass of JComponent class for displaying complex data structures. A JTable can follow the Model View Controller (MVC) design pattern for displaying the data in rows and columns. A JTable will generate TableModelListener, TableColumnModelListener, ListSelectionListener, CellEditorListener and RowSorterListener interfaces.We can validate whether the JTable cell is empty or not by implementing the getValueAt() method ... Read More

How can we filter a JTable in Java?

raja

raja

Updated on 12-Feb-2020 07:54:44

3K+ Views

A JTable provides a very flexible possibility to create and display tables. The TableModel interface defines methods for objects that specify the contents of a table. The AbstractTableModel class is typically extended to provide a custom implementation of a model table. A JTable class provides the ability to edit tables using the method ... Read More

How to implement the mouse right-click on each node of JTree in Java?

raja

raja

Updated on 12-Feb-2020 07:26:46

603 Views

A JTree is a subclass of JComponent class that can be used to display the data with the hierarchical properties by adding nodes to nodes and keeps the concept of parent and child node. Each element in the tree becomes a node. The nodes are expandable and collapsible. We can implement the mouse ... Read More

How to display "No records available" text in a JTable in Java?

raja

raja

Updated on 12-Feb-2020 07:15:04

331 Views

A JTable is a subclass of JComponent class and it can be used to create a table with information displayed in multiple rows and columns. When a value is selected from a JTable, a TableModelEvent is generated, which is handled by implementing a TableModelListener interface.In the below program, we can display "No records available" text ... Read More

Advertisements