Java Pilot Course Learning summary

Source: Internet
Author: User

After two weeks of four lessons in Java learning, I also have a certain understanding of the Java language. When I first started class, I thought Java emphasized the modular programming that the teacher in C taught me, carried out a class, a class of programming, constructs the corresponding method in the class, uses the time to call again. This reduces repetitive code and makes the overall code look neat. This writing procedure, debugging is easier,Eclipse's automatic error correction function is also very easy to use, feel written as a Java program on the basis of C language is relatively easy to complete. Later, slowly, the teacher introduced us to the object-oriented ideas and the use of these ideas in the Java language. Later, it became apparent that, with the introduction of various object-oriented ideas and the presentation of Java language features, it became more and more difficult to write programs. This is my overall impression of the object-oriented pilot course.

  This course has taught me:

  

Summarize what individuals have learned in this pilot course. The overall content of the first lesson has been summed up in the first blog post, which complements what was learned later.

The first is the constructor, the constructor can have a number of different constructors, here involves the teacher said in class Java class method name can be the same, but as long as the number of arguments or parameter types, return value type, etc. will be judged as different methods. So often there are methods with the same name but different parameter types, such as the IndexOf method in string type, can be a parameter, can be two parameters, can achieve their own goals. Therefore, the constructor method can have more than one, the method name of the constructor method is the same as the class name. If no construction method is defined, each property in the object is initialized to the default value, such as the value of the integer type is initialized to 0, and so on.

Java input and output is also very characteristic, just beginning to learn C language, is also the first to learn the output, and then teach input. However , the input and output types of C are not many, andthe input and output types of Java are very thin, which basically satisfies the input and output functions that you want to implement in C language. Java output Code is more concise, the basic few lines can be solved. But the input code feels more cumbersome to write. Later, the input and output ofJava is based on the input and output of the stream, which makes the input and output of the program independent of the device and does not care where the data source comes from. The Java data stream divides into the character stream and the byte stream, we use in the class generally is the character stream, through BufferedReader carries on the corresponding input.

Java interface is an important object-oriented idea, using java interface, we can define the corresponding abstract method in the interface, java interface is an important mechanism of java object-oriented language. With this mechanism, we can make the code more concise. These are what the teacher told us in class. But after the lesson, the meaning of the interface is not very able to understand. The interface is supplemented by the relevant content. First, because the interface definition is an abstract method, the corresponding concrete method in the class is also to be refactored, feel whether there is no impact of the interface should be small. Later through the Internet access to information about the relevant content. Understand why it is not straightforward to define a method in a class that involves the related content of an abstract class. In the java program to write more than one interface or abstract class, is for polymorphic can be implemented, if not the abstract class or interface for polymorphic implementation, then the program may be overloaded with many meanings of the same method, and each added a class, You need to overload the appropriate method. Code profile and maintainability are too low. Using interfaces or abstract classes to write programs, you can write a program that implements polymorphism, greatly reducing the repetition of the code, making the code look more concise. At the same time, it makes it easier to perform operations such as adding classes later. Although the implementation of the abstract class is very similar to the implementation of the interface, the abstract class and the java interface are two different mechanisms for java. Abstract class is the use of java inheritance, but java class is not to inherit more, so this time, the interface can come in handy. Using the interface, java program can implement the corresponding method from other places.

java string processing, java string processing is to abstract the string into a class for management. Through the corresponding method to manipulate the string, greatly simplifies the program string processing related code, from which you can feel the java in the class to program the advantages of the method. java string processing has many corresponding methods, in the blog I wrote earlier, we often use the split method to split the string. C language string processing is mainly by an array of corresponding operations, each time the code is rewritten and error-prone. and java after the string is abstracted into a class, each time according to the content to be processed mainly to change the method. It's just a call to the method, not the way the method behind it can be done. It is not like

< Span lang= "en-US" > Java runs faster than a freshman, learning python mentioned, C language running speed can be said to be the fastest language in the high-speed language, and java speed slightly slower , but also faster than python. After the pilot course of learning, learned that java The slow speed of some reasons, java hidden pointers, so the program can not directly manage memory allocation and so on. java will automatically carry out frequent GC activities to recover memory and so on. Although this makes the program more secure, it slows down the program's performance. Of course, the merits and demerits of data structures and algorithms will greatly affect the speed of the program in any language.

  Difficulties encountered in the job

  The difficulties encountered in these more challenging assignments have been mentioned in previous blogs and are supplemented accordingly. The first assignment was based on the instructions given by the TA, and in writing the last method, it was not recognizedIn Java, the object can also be used as a return value, so it was not possible to write the corresponding method according to the instructions given by the TA.Java abstracts the various data into objects,In Java, you can do a lot of things with objects, such as the ability to pass an object as a parameter, an object as a return value, or an array of objects to create an appropriate operation. The second job, because there was no previous contact with the input and output, so I encountered a lot of confusion in the input and output, and then consulted the file through the file input can be usedBufferedReader, and input via the console, you can usescanner this class for input. scanner This class can be processed directly after the contents of the console are read into. At the same time the second job writing process is also full of doubts about the interface. Then gradually learned that the job itself is not necessarily the interface, but the first operation if you can use the interface to achieve, you can achieve the above interface can be from other places to implement the corresponding method of this function, can be familiar with the interface. The third job does not have the rest of the object-oriented thinking of the introduction, but in class self-test, encountered a very serious bug. In each line of string processing, are directly using the indexof, and no other processing, resulting in if find of word, the position appears is the first character of, while the character of are contained in other words. Later after the class debug understand, should each find the location, adjust each indexof the location of the starting point, yes, each word after the search to remove from the scope. Self-test from this class can be seen, in fact, many times it is difficult to find bug, even if sometimes more obvious. Therefore, the self-test process under each class is actually very important. In the process of the final operation, hashmap according to the online tutorial, the use is still good, but our program how to organize hashmap at the beginning of a more overwhelmed. Just beginning to define a new class, the class has the first word and the second word two properties, and then hashmap value The number of occurrences of the phrase stored inside, and later found that this operation, There will be a lot of problems in the search for words, and after several attempts, the method of the last assignment is adopted. It seems that the output seems to be the right answer.

< Span lang= "en-US" > < Span lang= "en-US" > < Span lang= "en-US" > recommendations for this course:

< Span lang= "en-US" > < Span lang= "en-US" > This pilot class is my first contact with java, But after the fall. I felt that Mr. Wu and the TA helped us Open the door to the java. Also showed us a way to get through the oo course. The overall course gives me the feeling is very good, emphasizing programming practice, class teacher with everyone programming, class teacher and Ta always in the group to help everyone solve the problem. We can learn a lot from the mistakes of the last class. One of the suggestions I want to make is whether each assignment can show us a good job code that is better done. This way we can understand the programming habits and specifications of java by reading other good code. If you are afraid to read the code directly and not to modify their own program in the original bug words, big can at the end of the course, will all the excellent code to give everyone a copy, so that we can learn from the place.

Java Pilot Course Learning summary

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.