Java learning notes (4) Object-oriented and java learning notes

Source: Internet
Author: User

Java learning notes (4) Object-oriented and java learning notes
I. variable-length method when the number of function parameters passed in is unknown, add three dots (...) after the type of the last parameter of the method (...), it indicates that this parameter can accept multiple parameter values. Multiple parameter values are passed as arrays. These parameters must be of the specified type.

Package wbb. java. javaObject;/*** Created with IntelliJ IDEA. * User: wbb * Date: 14-7-17 * Time: * To change this template use File | Settings | File Templates. */public class MulParams {public static void main (String [] args) {mulFun ("basketball", "soccer");} public static void mulFun (String... ballName) {for (String name: ballName) {System. out. println (name );}}}
2. Method overload 1. If the Chinese method name of the same class is the same and the parameter type or number of parameters in the method is different, it is called method overload. 2. Different modifier and return value of the method are not method overload; 3. Notes for using super keywords: 1. If the member variables and methods in the parent class are defined as private, the Child classes will never be able to access them. If super is used. if you access the var variable of the private type of the parent class in the form of name, a compilation error will occur. 2. You can only use the super keyword in the constructor or strength method, but not in the static method or static code block.
Package wbb. java. javaObject;/*** Created with IntelliJ IDEA. * User: wbb * Date: 14-7-21 * Time: am * To change this template use File | Settings | File Templates. */public class OverWrite {public static void main (String [] args) {B B B = new B (); B. test () ;}} class A {public String name = "wbb"; public void test () {System. out. println ("parent class test method");} class B extends A {public void test () {System. out. println (super. name); super. test ();}}

Output result: Method 4 of the wbb parent class test, polymorphism 1. If the referenced variable is converted to a subclass type, it is called a downward transformation. 2. If the referenced variable is converted to a parent class, it is called an upward transformation; 5. The toString () method the toString method provided by the Object class always returns the class name + @ + hashCode value of the Object implementation class. The returned value does not actually implement the "self-description" function, if you want to implement the "self-description" function, you must override the toString method of the Object class.
Package wbb. java. javaObject;/*** Created with IntelliJ IDEA. * User: wbb * Date: 14-7-23 * Time: am * To change this template use File | Settings | File Templates. */public class ToString {public static void main (String [] args) {Animal animal = new Animal (""); System. out. println (animal) ;}} class Animal {private String name; public Animal (String name) {this. name = name;} // public String toString () {// return "the name of this dog is" + name ;//}}

The output result is: wbb. java. JavaObject. Animal @ f7f540. Remove the annotation code and rewrite the toString method to implement the object's self-description: The dog's name is Zhong qiangba.








''Java JDK6 Study Notes 'java Object-Oriented Programming ''' which book is better ·

Java JDK 6 Study Notes (Lin Xinliang)
A friend of mine has read this before and it feels pretty good. Suitable for entry

Recommended JAVA entry books

I. Basic
1. Thinking in java. The first entry is to establish a correct concept.
2. I have not read Core Java yet. This book is closer to practice, more API introductions, and more frequent updates.

Ii. Advanced
1. When you are familiar with the syntax and API, you need to know the best practices and traps.
2. Java Puzzlers introduces some Side corners that you may not have noticed through puzzles. It is also good for reading interesting books.
3. Deep Dive into the Java Virtual Machine (JVM), which has a general translation but cannot be read. It is best to read it in conjunction with the latest JVM specifications.

Iii. Specific fields
1. network programming:
(1) O 'Reilly's Java nio is recommended by many people. I personally think it is generally just a more detailed description of the API, O 'Reilly's many java series are like this.
(2) I recommend Fundamental networking in java to teach you how to do java Network Programming and introduce a lot of background knowledge, I even introduced various best practices, network programming models, and differences between Java sockets on different platforms.

2. Concurrent Programming:
(1) Java Concurrency in Practic, which must be read in the Concurrency field.
(2) Java concurrent programming: design principles and patterns, also works by Doug lea.
(3) java threads, getting started.

3. Pattern and Design
1. design pattern, classic of GOF.
2. The latest version of design patterns should be available. I personally think it is more suitable for getting started.
3. Head first design patterns for easier entry books.
4. Enterprise Application Architecture Model
5. Analysis Mode-reusable Object Model
6. The pattern-oriented software architecture seems to have translated three volumes in China, which is absolutely classic. Unfortunately, the translation is poor.
7. refactoring-improving existing code design. To write code, you must read it.
8. Reconstruction and Model

4. Methodology
1. Agile Software Development
2. Test-driven development, you do not have to use TDD, but you must learn to do unit testing.
3. Agile Java can also be used as an entry point for java.
4. Fast Software Development
5. Object-Oriented Analysis and Design, required for OO design.
6. Unix programming art opens your eyes.

5. Outside of Java
1. unix network programming, learning network programming is essential.
2. Introduction to ACE in the upper and lower volumes of C ++ network programming, but the introduction to various modes is very valuable.
3. Joel software, programming Culture
4. Mythical man-month and man-piece
5. A book inspired by "fruitful programmers.
6. programmer Cultivation
7. Construction and interpretation of computer programs
8. Introduction to algorithms, which can be used as reference books
9. in-depth understanding of computer systems
10. Long Shu, compilation principles, explained in java in the latest version.

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.