20165208 2017-2018-2 "Java program design" Eighth Week study summary textbook Learning content Summary Chapter 12th thread State
To create a thread object
Created directly with the thread class or subclass: Thread(Runnable target) creates a thread, gets the current thread object, and getName() returns the name of the thread.
Use the Runnable interface: more flexible than thread
20165327 2017-2018-2 "Java program Design" 9th Week Study Summary Teaching Contents Summary 13th chapter (a) Study contents summary of the textbookUnderstanding a URL class is an abstraction of a Uniform Resource locator, and an application that uses a URL to create an object is called a client program.A network socket is a TCP protocol-based connected communication, where a socket connection is the socket
2017-2018-20172309 "Java Programming" course pair programming Exercises _ arithmeticTeam member: ShanshaStudy No.: 20172310Blog Address: Click here1. Demand Analysis:
can generate the topic:-Enter the number of topics you want to generate and output a set of topics at random levels.-Operator stochastic equal probabilities (subtraction), arithmetic random probabilities (integers, true fractions).
20165209 2017-2018-2 "Java program Design" 7th Week Study summary Textbook study summary
Install the EAMPP and complete the configuration
EAMPP Connection Database
Create a database
Learn to query operations
Problems in teaching materials learning and the solving process
Issue 1: The following error occurred while initializing MySQL
mysqld: Could not create or access
20165219 2017-2018-2 "Java Program Design" 8th Week study summary Textbook learning content summary process and threadsA thread is a smaller unit than a process, and some memory units in a process can be shared between threadsJava's multi-line mechanism thread class and thread creationOne way to create a thread is to Thread create the thread object directly with the classUsing Runnable interfaces is Thread
[];Note: Java does not allow brackets in the declaration array to specify the number of array elements, that is, do not allowint a[10]或int [10]a;
Distribution数组名 = new 数组元素的类型[数组元素的个数]Note: Java allows you to specify the number of elements of an array using the INT variable, which allowsint size=10;double number[]=new double[size];
Problems in teaching materials learning and the solving processIn a
Learning progress Bar
lines of code (new/cumulative)
Blog Volume (Add/accumulate)
Learning Time (new/cumulative)
Important Growth
Goal
5000 rows
30 Articles
400 hours
First week
200/200
1/4
10/10
Second week
300/500
1/5
10/20
Third week
800/1300
1/6
20/40
Week Four
700/2000
the maximum thread size that the operating system (or JVM) can create.4.NewscheduledthreadpoolCreate a thread pool of unlimited size. This thread pool supports the need to schedule and periodically perform tasks.InstanceCallable class PackageCallableimp;Importjava.util.concurrent.Callable; Public classCallableimpImplementsCallable{ Private intnum; PublicCallableimp (intnum) { This. num=num; } @Override PublicInteger Call ()throwsException {intSum=0; for(inti=1;i) {sum=sum+i; }
test-In Ubuntu or Windows command line, build the following directory structure (refer to the accompanying drawings)
2016XXXX (School number)SrcHello.javaBin
The contents of the Hello.java are shown in the annexPackage isxxxx; (xxxx is replaced by your four-digit number)
Compile run Hello.java, submit run result, to full screen
Do git add in class; git commit, push code git to the code cloud in class
The running results and directory structure are as follows
understand some of the problems and actions that have never been encountered.Learning progress Bar
lines of code (new/cumulative)
Blog Volume (Add/accumulate)
Learning Time (new/cumulative)
Important Growth
Goal
5000 rows
30 Articles
400 hours
First week
200/200
1/4
10/10
Second week
300/500
1/5
10/20
Third week
800/1300
1/6
have the following program fragmentsinterface Some{int x = 10;}public class Main{public static void main (String [] args) { System.out.println(Some.x); }}The following description is correctA. Compilation failedB. Showing 10C. You must create an some instance to access XD. Showing 0Correct answer: BImpressionsThis week's focus is on the eighth chapter of the study, before just mechanically using such as String and scanner classes, through this chapter on the "Class" has a new understanding,
= args[1];String s2 = args[2];String s3 = args[3];System.out.println (S3);}}A. A compilation error has occurred in the program.B. No compile error, execute program at command line: "Java E I love this game", program output this.C. No compile error, execute program at command line: "Java E let us go", program no run exception.D. No compile error, execute program at command line: "
iteratorIterator Iterator =List.iterator (); intnum = 0; while(Iterator.hasnext ()) {iterator.next ();//the cursor points to the next, this is important, no errorIterator.remove (); Num++; if(num = = 5) {//Delete Front 0 to 4, exit loop now Break; } } //Create a User objectUser meizi=NewUser ("Meizi", "female", 18); //change the value of the first element in a collectionList.set (0, Meizi); //displays the specific properties of the elements inside the collection//
public class Fruit implements Serializable* Object Fruit successfully written to the file D:\\temp\\fruit.ser*//*** Deserialization, Fruit.ser deserialized into fruit object output console*/InputStream in = new FileInputStream ("D:\\temp\\fruit.ser");ObjectInputStream ObjectInputStream = new ObjectInputStream (in);Fruit Fruit = (Fruit) objectinputstream.readobject ();System.out.println (F.getname () + "\ T" +f.gettype () + "\ T" +f.getproduction ());/** Output Result:* Apple001china*/}}Package
The1 Public classEqualsmethod2 {3 Public Static voidMain (string[] args)4 {5Integer N1 =NewInteger (47);6Integer N2 =NewInteger (47);7System.out.print (N1 = =n2);8System.out.print (",");9SYSTEM.OUT.PRINTLN (N1! =n2);Ten } One}Output Result:False,trueNote: Use integer a = 1, or integer a = integer.valueof (1), or a value between 128 and 127 as the base type. Use integer a = new integer (1), regardless of the value, as the object. No.21 class parent{2public float afun (f
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.