包含标签:Java 的文章
-
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…… -
Multi thread ticketing case
Tickets implements runnable: Public class tickets implements runnable {/ / define the ticket source that can be sold p…… -
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…… -
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…… -
Practice defining class student classes
The code is as follows: (use member variables defined in other classes in one class) package demo04; /* * Define class…… -
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…… -
Serialization and deserialization of objects
Person_ Class 1: import java. io. Serializable; public class Person_ 1 implements Serializable { private String name; …… -
Array fill
import java.util.*; public class array_fill { public static void main(String[] args) { int array[]=new in…… -
Practice using enumeration to display traffic light colors
The code is as follows: //Practice using enumeration to display traffic light colors class demo11 {public static void …… -
Input positive and auxiliary numbers from the keyboard, count the number of positive and negative numbers respectively, and calculate the sum of all numbers
The code is as follows: /*Input positive and auxiliary numbers from the keyboard, count the number of positive and neg…… -
Synchronous code block to achieve multi-threaded secure ticketing case
Class tickets implements the runnable interface: /** use the synchronization method to solve the thread safety problem…… -
Practice judging the number of days in a month
The code is as follows: /*Enter a year and month, and output the corresponding days of the month * / import Java util.…… -
Inherited programming exercises
Access the father class through son: The code is as follows: Father class: Public class father {/ / instance variable …… -
Read text from character input stream FileReader class
import java. io. FileReader; import java. io. IOException; /* * The character input stream reads text files (only text…… -
Nesting of sets
The code is as follows: import java. util. HashMap; import java. util. Map; import java. util. Set; import java. util.…… -
Thread pool-2
Subclass implementation interface: import java. util. concurrent. Callable; /* * The implementation class of callable …… -
First acquaintance with Java
Theory Experiment [learning purpose] 1.) understand java 2.) create your first java project and be familiar with Java …… -
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…… -
Implement multithreaded thread
Define a subclass subthread to inherit thread: /** define subclasses, inherit thread * / public class subthread extend…… -
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 = …… -
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…… -
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…… -
Practice complete employee classes
Employee class: /** employees* Extraction of commonness * name, number, working method (Abstract) * / public class emp…… -
Configuring JDK environment variables in Windows 10 environment
1、 Environmental preparation windows10 jdk-10 2、 Download and install the JDK 3、 Configure environment variables 1.…… -
Call the method to calculate the area of the rectangle
The code is as follows: import java. util. Scanner; Public class demo {public static void main (string [] args) {syste…… -
Gets the number of uppercase letters, lowercase letters, and numbers in the specified string.
The code is as follows: import java. util. Scanner; /* * Gets the number of uppercase letters, lowercase letters, and …… -
Delete array elements
import java.util.ArrayList; public class array_delete { public static void main(String[] args) { method_1…… -
Practice outputting the highest and second scores
The code is as follows: //Practice outputting the highest and second scores import Java util. Scanner; Class demo20 {p…… -
Multi branch practice lottery game, randomly generate two one digit random numbers, and prompt the user to enter the guessed number
The code is as follows: /*Multi branch practice lottery game, randomly generate two one digit random numbers, and prom…… -
Recursive call of exercise method
Five people sat together and asked how old the fifth person was? He said he was 2 years older than the fourth person, …… -
Merge arrays using lists
import java.util.Arrays; import java.util.ArrayList; import java.util.List; public class array_merge { public sta…… -
Find the difference set between two arrays
import java.util.ArrayList; public class array_diffrence { public static void main(String[] args) { Array……
