Do you really know java class name?

In the object-oriented world, Class is the foundation of Java. java.lang.Class is actually inherited from java.lang.Object. Class has a method called getName, which returns the class name of (class, interface, array class, primitive type, or void). If you often debug the JVM, you will see the following strange things: jcmd 1234 GC.class_histogr ...

Posted by Benaravo on Sun, 10 May 2020 07:22:24 -0700

Java fun sharing: try & finally

Consider the following four test methods, and what do they output? public class Test {     public static void main(String\[\] args) {         System.out.println(test1());         System.out.println(test2());         System.out.println(test3());         System.out.println(test4());     }     private static int test1() {         int i = ...

Posted by nayone on Fri, 08 May 2020 07:31:28 -0700

Summary of jvm learning [past and present life of a class]

1 I am Queen of the Jing King of Zhongshan Hello, my name is Li Dahammer, and I am an unrivalled actor. I am about to participate in a stage play called The Romance of the Three Kingdoms, directed by Mr. Luo Guanzhong, an old man whose coffin cannot be pressed down.And I, Uncle Liu, who is about to play one of the three leading characters, hey ...

Posted by Pasa Mike on Thu, 07 May 2020 10:20:05 -0700

Java Multithreaded Recording (Including Cases)

Threads are the execution units of programs, execution paths.Is the most basic unit of CPU used by programs Multithreaded -- Programs have multiple execution paths to improve usage of application processes The more threads in the process, the higher the probability of seizing CPU execution rights.Thread execution is random   How Java programs w ...

Posted by bogdan on Mon, 04 May 2020 23:59:15 -0700

Java learning note 24 (Integer class)

The basic data type wrapper class is introduced here. Integer is the wrapper class of int, The methods of wrapper classes of other basic data types are almost the same as those of Integer, and one of them can be used for plenary session Characteristics of basic data type wrapper class: used for conversion between basic data type and string Thes ...

Posted by himani on Sun, 03 May 2020 10:58:47 -0700

Single case mode of 23 design modes

In core java, there are three types of design patterns, which can be further divided into the following parts: 1. Create design mode Factory mode Abstract factory pattern Singleton mode Prototype mode Builder mode Structural design mode Adapter mode Bridge mode Combination mode Decorator mode Facade mode Flyweight mode Proxy mode Behavio ...

Posted by ChrisMayhew on Thu, 30 Apr 2020 11:16:27 -0700

Spring Boot Aspect Aop thought

Spring Boot Aop Scope of Aspect Comment writing of interception rules Writing configuration file Aopconfig The compilation of add operation of comment interception Operation writing of add intercepted by method The writing of logAspect facet Writing of Main Operation results Scope of Aspect In o ...

Posted by rocky on Wed, 29 Apr 2020 21:17:19 -0700

Using jstat to observe the state of jvm

jstat -gc pid time For example: print jvm usage every 3 seconds [root@i-5uvhvror bin]# ./jstat -gc 17474 3s S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT 2560.0 2560.0 1712.5 0.0 2790912.0 1661843.1 5592576.0 230780.6 136704.0 129435.4 15872.0 ...

Posted by BenProl on Wed, 29 Apr 2020 03:01:14 -0700

Implementation principle of synchronized

What's the difference between having synchronized or not? What does synchronized lock as a pessimistic lock? How to use synchronized code block In the previous three articles, we talked about two uses of synchronized: synchronization method and synchronization code block, as well as two lock mechanisms: Lock instance object and lock Class obj ...

Posted by Jonah Bron on Tue, 28 Apr 2020 18:58:00 -0700

How to use synchronized code block

What's the difference between having synchronized or not? What does synchronized lock as a pessimistic lock? In the previous two articles, we have known how to use synchronized and the content of lock (instance object and Class object), which has covered the basic content of this keyword. Today, I want to introduce another writing method, whi ...

Posted by Full-Demon on Mon, 27 Apr 2020 18:55:23 -0700