The first week of object-oriented programming (Java) Learning Summary
Part I: Course preparation section
Platform Name |
Registered Account |
Blog Park: www.cnblogs.com/ |
https://www.cnblogs.com/zd0421/ |
Program Design Evaluation: https://pintia.cn/ |
[Email protected] |
Code Hosting Platform: https://github.com/ |
Stppkj |
Chinese University mooc:https://www.icourse163.org/ |
17393165076 |
The following answer is yes or no |
Whether to join the Course Class blog group |
Is |
Whether to join the course QQ Discussion Group |
Is |
Part II: Theoretical Knowledge Learning Section
Chapter I.
The first chapter is to learn the Java language as the advantage of high-level programming language, a brief history of development, and the key terminology of the Java language, learning the first chapter so that we can better use the Java language.
1. The Java language is a good programming language, like other excellent languages,Java has a pleasing syntax and easy to understand semantics, while Java is a complete platform, there is a complete library is a high-quality execution environment.
2. "White Paper"
The whitepaper is simple, with key terms such as object-oriented, distributed, robust, security, architecture-neutral, portability, interpretive, high performance, multi-threading, and dynamic.
1) Simplicity:Java is designed to be similar to C + +, but excludes features that are rarely used, difficult to understand, and confusing in C + +. For example, there are no header files, pointers, etc.
2) Facing objects:Java focuses on data and object interfaces, with multiple inheritance
3) Distributed:Java has a rich example of libraries, which opens and accesses objects on the network through a URL, just like accessing a local file
4) Robustness:Java has fewer bugs, can detect many problems at runtime, and using a pointer model can eliminate the possibility of rewriting memory and corrupting data.
5) Security: TheJava browser no longer trusts remote code
6) Architecture neutrality:Java compiler compiled code can run on many processors that are not related to a particular computer architecture
7) Portability : Java data types have a fixed size, and a portable interface is defined, and the size of the base data type and the operations are clearly explained
8) Explanatory:Java interpreter can be a star Java bytecode on any machine that ported the interpreter
9) High energy: bytecode can be translated dynamically into the corresponding machine code for the specific CPU running the application . The instant compiler can monitor the code that executes frequently and optimizes the code to improve speed.
10) Multithreading: Get more processors and keep them working
11) Dynamic:Java can adapt to the constantly evolving environment, the library can freely add new methods and instance variables, and no impact on the customer
3. Through a brief history of Java development, to better grasp the Java language, distinguish between java Se,java ee, etc.
Chapter II
This chapter focuses on how to install the Java Development Kit (JDK) and how to compile and run different types of programs: console programs, graphical applications, and applets
1. Install the Java Development Kit (JDK) and set up the jdk
2. Using command-line tools
3. Using the Integrated development environment
4. Run a graphical application
5. Build and run applets
The third part of the experiment
1 , Experiment name: Experiment one Java Programming Environment
2. purpose of the experiment:
( 1 ) Master JDK installation and configuration;
( 2 ) Master the use JDK Development Java the basic order and procedure of the procedure;
( 3 ) Skilled use Elipse Integrated development Environment Development Java Basic steps of the program
( 4 ) Master Java the basic syntax of the program.
3. Experimental Steps and Contents :
Experiment One
( 1 ) Download JDK and install
Click Java (JDK) for developers, then the following interface appears
Click ( JDK ) DOWNLOAD
The following page appears
Click on the First Circle button and click windous version download, and then install
( 2 ) Configure environment Variables
Add Java_home,classpath and other environment variables, edit Path variables
Open cmd command prompt, enter Java , Javac , Java-version, if the following interface is displayed, the configuration is successful
Experiment 2 Download the textbook sample package
Download Web link: http://horstmann.com/corejava.html, file name: Corejava.zip
Experiment 3 Run the following program from command-line compilation
Follow the steps below to experiment
(1) Create directory D:\java. Use this directory as the working directory for the experimental program of this course. Java source code, compiled bytecode files are placed in this directory.
(2) Start a text editor (such as WordPad, Notepad, etc.) to copy the following source code. The 2nd chapter of the textbook is the sample program (Welcome.java).
1/**
2 * This program displays a greeting for the reader.
3 * @version 1.30 2014-02-27
4 * @author Cay Horstmann
5 */
6 public class Welcome
7 {
8 public static void Main (string[] args)
9 {
Ten String greeting = "Welcome to Core java!";
System.out.println (greeting);
(int i = 0; i < greeting.length (); i++)
System.out.print ("=");
System.out.println ();
15}
16}
(3) Save the program. Note: When you save the source program, the program name is the same as the main class name. So use Welcome.java as the file name of this program. If you are writing a program in Notepad, the default extension for Notepad is. txt, so you want to enclose the file name in quotation marks. Save the file in the directory D:\java.
(4) Compile the program. After directory d:\java>, enter the following command to compile the source program into a bytecode program
Javac Welcome.java
If the compilation succeeds, the bytecode file Welcome.class is generated in the D:\java directory. If unsuccessful, an error message is displayed and the user can modify the error,
(5) Running the program
After the directory d:\java>, enter Welcome to run the compiled program.
(6) Observe the program running results and understand the Java Basic program structure.
Lab Four developing the Hello World program with the JDK command line
Lab 4 developing helloworld! with JDK command line Program.
1) Create a new. txt file named: Helloworld.java (note that at this point the file is not hidden suffix) content is:
1 public class helloworld{
2
3 public static void main (String []args) {
4
5 System.out.print ("Hello World");
6
7}
8
3 ·
Run with Eclipse and the results are as follows
experiment five using the Elipse development Program output 99 multiplication table
1) After installing Eclipse, open and set up the working space.
2) Create a Java project file
3) The results of the operation are as follows
Master the basic syntax of Java programs.
1) A Java program can be thought of as a collection of a series of objects that work together by invoking each other's methods. The following is a brief introduction to the concepts of classes, objects, methods, and instance variables.
Object : An object is an instance of a class that has state and behavior. For example, a dog is an object whose state is: color, name, variety, behavior: wagging the tail, barking, eating, etc.
class : A class is a template that describes the behavior and state of a class of objects.
method : The method is the behavior, a class can have many methods. Logical operations, data modifications, and all actions are done in a method.
instance variables : Each object has a unique instance variable, and the state of the object is determined by the value of these instance variables.
2) When writing Java programs, you should pay attention to the following points:
Case-sensitive : Java is case-sensitive, which means that the identifier Hello is different from hello.
class name : For all classes, the first letter of the class name should be capitalized. If the class name consists of several words, the first letter of each word should be capitalized, such as Myfirstjavaclass.
Method name : All method names should start with a lowercase letter. If the method name contains several words, the first letter of each subsequent word is capitalized.
source file Name: The source file name must be the same as the class name. When saving the file, you should use the class name to save the filename (remember that Java is case-sensitive), and the suffix of the file name is. java. (a compilation error is caused if the file name and the class name are not the same).
Main method entry : All Java programs are executed by the public static void main (String []args) method.
4. Experiment Summary:
Through learning the contents of these two chapters, I have a preliminary understanding of Java development process, mastered the Java Runtime Environment,Java tools and Java Basic Library, learned how to configure the Java program to build the environment to build, and mastered the Installation and configuration of the JDK. Through the JDK command and the Eclipse software respectively developed the HelloWorld program and 99 multiplication Table program experiments, I basically mastered the use of the JDK Java Program Development of BASIC commands and procedures, and can skillfully use Developing Java programs in the Elipse integrated development environment . Although in this process encountered a lot of problems, sometimes even feel that they do not learn, but in the roommate's explanation and help or completed the experiment, built a little confidence, I believe in the next study I can complete the study task, Java This course to learn.
Zhao 201771010137 "Object-oriented Programming (Java)" First week study summary