18, IO stream (continuous update...)

18, IO stream 18.1 File class 18.1.1 introduction to file class java. io. The file class is an abstract representation of the path names of * * files * * and directories. It is mainly used for the creation, search and deletion of files and directories File can be encapsulated into an object file, and the encapsulated object is only a pathnam ...

Posted by virva on Wed, 05 Jan 2022 21:00:54 +0100

JAVA object oriented programming (in)

JAVA object oriented programming (middle) (3) The second and third characteristics of oop: Inheritance and polymorphism 3, The second feature of object-oriented: Inheritance 1. Inherited benefits: ① Reduced code redundancy ② Convenient for function expansion ③ It provides the premise for the later use of polymorphism 2. Inherited format: Class ...

Posted by gbow on Tue, 04 Jan 2022 13:58:40 +0100

Reflection of Java

Four methods to obtain Class instances Call the properties of the runtime classCall getClass() through the object of the runtime classCalling Class static method: the most commonly used method in forName(String classPath) developmentLoader using class: ClassLoader (just know) package day_12_29; import org.junit.Test; /** * @author ...

Posted by andrewb on Mon, 03 Jan 2022 16:16:54 +0100

Java simple design pattern

Java simple design pattern The realization of design pattern is to make it easier to maintain, more concise, high decoupling, reduce memory consumption and other excellent characteristics. 1. Singleton design pattern Singleton design pattern: ensure that a class has only one instance, and provide a global access point to access i ...

Posted by austingecko on Mon, 03 Jan 2022 12:28:06 +0100

JavaSE learning notes (Day8)

Day8 java exception concept Exception: in the Java language, abnormal conditions during program execution are called "exceptions" Exceptions (all abnormal conditions at runtime) that occur during the execution of Java programs can be divided into There are two types: Error: serious problems that cannot be solved by the Java vi ...

Posted by daimoore on Sun, 02 Jan 2022 15:42:47 +0100

Internal classes of the five members of the [JavaSE] [object-oriented 06] class

Class: Inner Class 1. Why have inner classes 1. Internal scenario When there is an internal part of a thing that needs a complete structure to describe, and the internal complete structure only provides services for external things, it is best to use the internal class for the whole internal complete structure. 2. Internal features Declared a ...

Posted by medaswho on Thu, 30 Dec 2021 13:09:29 +0100

Common sorting algorithm - Java implementation [to be improved]

1. Bubble Sort Compare adjacent elements and exchange if a (n) > A (n + 1). After a round of exchange, you can ensure that the last bit a(length - 1) is the maximum. After the ith comparison is completed, you can ensure that the length - 1 - i ~ length - 1 bits are the incremental sort of the maximum number in the array. Since sorting ma ...

Posted by Trader77 on Wed, 29 Dec 2021 13:01:50 +0100

Collection 01

Set (set frame) Collection is an interface. It is a data structure used to store objects. Its length is variable, and different types of objects can be stored in the collection. It also provides a series of methods to operate this object. It is divided into external interface, interface implementation, and set framework algorithm. Like ar ...

Posted by nwoeddie23 on Tue, 28 Dec 2021 22:03:08 +0100

Comparison of several ways of Java array to List

In actual development, we often encounter the scene of converting arrays into collections. Various processing methods are as follows: Suppose we have an array of strings String[] arr = {"1", "2", "3"}; The most brainless way (not necessarily the worst) Define a new set, traverse the array, and then add it to the set after data format ...

Posted by patrickm on Mon, 27 Dec 2021 07:42:30 +0100

JavaSE -- Lambda expression

Lambda expression Introduction: Lambda expressions, also known as closures, are the most important new feature that drives the release of Java 8. Lambda allows functions to be used as parameters of a method (functions are passed into the method as parameters). Using Lambda expressions can make the code more concise and compact. Standard forma ...

Posted by payney on Mon, 27 Dec 2021 05:36:30 +0100