In depth understanding of String

preface *** reference material: Deep understanding of String in Java 1, Analysis of the underlying source code of String class Let's take a look at the source code of the String class: public final class String implements java.io.Serializable, Comparable<String>, CharSequence { /** The value is used for character storage ...

Posted by firecircle on Thu, 17 Feb 2022 17:12:36 +0100

java daily exercise day01

1. Letter guessing game 1. Randomly generate 5 letters - > character array2. Users guess letters - > console guess - > character array3. Compare the two character arrays, the correct number of letters and the correct number of positions4. The user guesses wrong and repeats 2 and 3 package day04.game; import java.util.Arrays; import ...

Posted by halfman on Thu, 17 Feb 2022 13:23:30 +0100

Comparison between Comparable and Comparator based on Java

Comparison between Comparable and Comparator in Java Introduction to Comparable Comparable is a sort interface. If a class implements the Comparable interface, it means that "this class supports sorting". That is, classes that implement the Comparable interface support sorting. Assuming that there is a "List (or array) o ...

Posted by kevo1162 on Thu, 17 Feb 2022 05:25:03 +0100

Java--String "+", StringBuffer and StringBuilder

1, String String: string constant. The length of the string is immutable. In Java, string is immutable The underlying code of String is a char array decorated with final. After defining a String variable, the content of the variable is immutable We can view the source code as follows: public final class String implements java.io.Seriali ...

Posted by Micah D on Thu, 17 Feb 2022 05:04:00 +0100

Object oriented programming in Java se

catalogue 1, Abstract class 1. Concept 2. Grammar rules 3. Some precautions 4. Role of abstract classes 2, Interface 1. Elaboration 2. Grammar rules 3. Some writing standards 4. Implement multiple interfaces 5. Inheritance between interfaces 6. Interface usage examples 7.Clonable interface and deep copy 8. Differences between inte ...

Posted by kranthi117 on Sat, 12 Feb 2022 10:33:47 +0100

Understanding of Java String class

โญ Preface โญ ๏ธ ๐Ÿ‰ Blog home page: ๐Ÿ [warm the sun like the wind]๐Ÿ ๐Ÿ‰ Boutique Java column [Javase],[Java data structure] ๐Ÿ‰ Welcome to like ๐Ÿ‘ Collection โญ Message comments ๐Ÿ“ Private letters must be answered ๐Ÿ˜ ๐Ÿ‰ This article was originally written by [Rufeng Wenyang], and was first launched in CSDN ๐Ÿ™‰ ๐Ÿ‰ Bloggers will continue ...

Posted by johnc71 on Thu, 10 Feb 2022 11:28:52 +0100

Error handling mechanism in javase Java

Basic exception handling syntax and procedures The error handling mechanism in Java refers to non compiled errors, that is, non syntax errors. Similar to the division by zero error, that is, you can't divide by 0 during division. Java will encounter the following errors: example: system out. println(16 / 0); The ArithmeticException here is ...

Posted by nihal on Wed, 09 Feb 2022 14:36:26 +0100

Linked list and implementation of Java data structure

The previously learned sequence table query is very fast, and the time complexity is O(1), but the efficiency of addition, deletion and modification is very low, because each addition, deletion and modification will move the elements. You can use another storage method - chain storage structure. Linked list is a non continuous and non sequenti ...

Posted by programming_passion on Mon, 07 Feb 2022 09:06:02 +0100

About lock objects

There are two kinds of lock objects: Class object and Class template object 1. Under standard conditions, two threads and one object, print and send text messages or call first? send message 2. After setting the SMS method with a delay of 4 seconds, two threads and one object print and send SMS or call first? send message The object of the ...

Posted by kristoff on Sun, 06 Feb 2022 20:49:34 +0100

Summary of Java Se and objects

catalogue 1, Preliminary understanding of classes and objects 2, Member of class ย 1. field 2. Method 3.static keyword 3, Encapsulation 1. What is encapsulation 2.private implementation encapsulation 3.getter and setter methods 4, Construction method 5, Code block 6, Supplement 1.toString method: ย 2. Anonymous object 1, ...

Posted by peddel on Thu, 03 Feb 2022 19:26:29 +0100