Java Basics

Arrays Common Methods of Manipulating Arrays in Java

The Arrays class contains various methods for manipulating [arrays] (such as sorting and searching). Also contains a static factory that allows converting an array to a List. method describe <T> List<T> asList(T… a) Returns a List constructed from the specified array void sort(Object[] a) sort the array void fill(Object[] a, Object val) assign the same …

Arrays Common Methods of Manipulating Arrays in Java Read More »

Java Foundation Series String Type Conversion Map

Sometimes the data of [String] type is taken out in a very standard key and value form. In fact, it can be converted into Map through Gson. The first way: Gson gson = new Gson(); Map<String, Object> map = new HashMap<String, Object>(); map = gson.fromJson(jsonString, map.getClass()); String str = (String)map.get("xxxx"); The second way: public static …

Java Foundation Series String Type Conversion Map Read More »

How to understand polymorphism in Java – detailed explanation

concept 🎈🎈🎈This article mainly explains [polymorphism] in Java , so what is polymorphism? Objects of the same type, performing the same behavior, will exhibit different behavioral characteristics. Next, let us explain polymorphism in detail. Common forms of polymorphism: superclass type object name = new subclass constructor; interface object name = new implementation class constructor; //Parent …

How to understand polymorphism in Java – detailed explanation Read More »

How to understand abstract classes in Java – detailed explanation

introduction This article mainly explains the concept of [abstract classes] in Java , application scenarios, characteristics of abstract classes, and template method patterns. I hope it can help you in the process of learning Java. concept ✍️In Java, abstract means abstract, which can modify classes and member methods . 💪 abstract modifies a class, this …

How to understand abstract classes in Java – detailed explanation Read More »

Calendar usage and Date usage in Java (detailed)

Table of contents 1. Commonly used Calendar Calendar programming example Second, the commonly used class Date Date programming example 1. Commonly used Calendar In earlier JDK versions, the Date class came with two main functions: Dates are allowed to be interpreted in terms of years, months, days, hours, minutes, and seconds. Allows formatting and parsing …

Calendar usage and Date usage in Java (detailed) Read More »

Java GUI implements the login interface

Specific renderings: Detailed code: package java_gui; import java.awt.Color; import java.awt.Container; import java.awt.Cursor; import java.awt.Font; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPasswordField; import javax.swing.JRootPane; import javax.swing.JTextField; public class Login extends JFrame { private static final long serialVersionUID = – 6788045638380819221L ; …

Java GUI implements the login interface Read More »