包含标签:Java 的文章
-
Automatic completion of copyright notice and class annotation in java development
In Java project development, it is inevitable to add some copyright notices or class comments to the coded files. If t…… -
[Java interview eight part essay] JVM
1. Let's talk about the JVM memory model (runtime data area) The JVM memory model is divided into two parts: thread sh…… -
Detailed explanation of thread pool of JUC package
Why use thread pools Architecture of JUC process pool Two methods of creating thread pool Seven parameters of thread p…… -
On the strategy of thread safety realized by synchronized and volatile
What is thread unsafe My understanding of thread safety is that when multiple threads operate on a shared variable at …… -
Thread waiting and wake-up cases
Define resource classes: /** define a resource class with two member variables * name, sex * and two threads to operat…… -
Define a method to find the maximum common divisor of two integers
import java. util. Scanner; /* * Define a method to find the maximum common divisor of two integers * / public class d…… -
First acquaintance with Java
Theory Experiment [learning purpose] 1.) understand java 2.) create your first java project and be familiar with Java …… -
Collection framework – Landlords game
The code is as follows: import java. util. ArrayList; import java. util. Collections; import java. util. HashMap; /* *…… -
Multi thread ticketing case
Tickets implements runnable: Public class tickets implements runnable {/ / define the ticket source that can be sold p…… -
Define automobile engine class to output automobile information
The code is as follows: public class Demo { public static void main(String[] args) { // TODO Auto-generated method stu…… -
Analog computer USB interface
//Computer class: /** computer class. The computer has a USB slot * / public class computer {private USB; / / indicate…… -
Practice outputting an integer in reverse order
The code is as follows: /*Practice outputting an integer in reverse order, and take out the numbers of bits, tens, hun…… -
Use the calendar class to get the year, month and day
import java.util.Calendar; public class time_Calender { public static void main(String[] args) { Calendar…… -
Implement multithreaded thread
Define a subclass subthread to inherit thread: /** define subclasses, inherit thread * / public class subthread extend…… -
Byte stream copy file – byte stream
} Speed comparison between byte stream and byte copy: One 20m file: byte stream 70mm, byte 40000 mm -
Interface as a parameter and return value of a method
Interface smoking: public interface Smoking { public static final int a=1; public abstract void smoking(); } Student c…… -
Change whole money for change
The code is as follows: /*Change the whole money. If there is a decimal point 2.94, it shows how many 1 yuan, 5 Mao, 2…… -
Static internal class programming exercise
Outer class: Public class outer {int XX = 10; static int YY = 20; / / static inner class static class inner {int ZZ = …… -
Define author book class
Four classes are defined: Publishing House class (defining and displaying publishing house information), author class …… -
Practice calculating different types of car rentals
The code is as follows: Vehicle class: Public class vehicle {/ / return the total rent public double getsum (int days)…… -
Practice defining class student classes
The code is as follows: (use member variables defined in other classes in one class) package demo04; /* * Define class…… -
Several common sorting algorithms in Java
Several common sorting algorithms in Java 1. Sorting is the operation of arranging a string of records incrementally o…… -
Programming to realize “electronic pet mall”
*/ The code is as follows: //Test class Public class demo {public static void main (string [] args) {dog H = new dog (…… -
Abstract classes are used as parameters and return values of methods
Abstract class animal: public abstract class Animal { public abstract void eat(); } Subclass cat: Subclass dog: Public…… -
Interface exercises, teacher student
Working class: /** encapsulate this function in an interface * / public interface working {void sendad(); / / the meth…… -
Find the odd sum of any two number ranges
The code is as follows: /*Find odd numbers such as any two number ranges and * / import Java util. Scanner; Class demo…… -
Implementation of random roll call device
The code is as follows: /** random roll call: * 1 Store name * 2 Preview owner's name * 3 Randomly choose a person's n…… -
Calling exercise of construction method in word parent class
Person class: (parent class) Public class person {private string name; private int age; public person() {this ("Li Si"…… -
Define a date class: including three member variables: year, month and day, and the method of displaying the date
*/ The code is as follows: public class Demo { public static void main(String[] args) { Date date1=new Date(1994,5,22)…… -
Date class and its methods
The code is as follows: import java. text. SimpleDateFormat; import java. util. Date; Public class datedemo {/ / get t…… -
Serialization and deserialization of objects
Person_ Class 1: import java. io. Serializable; public class Person_ 1 implements Serializable { private String name; ……