Alibabacloud.com offers a wide variety of articles about java object oriented programming interview questions, easily find your java object oriented programming interview questions information here online.
The Java language provides an interface mechanism. This interface makes Java object-oriented programming more flexible. We can use interfaces to define the expression of a class, but interfaces cannot contain any implementations. In the book thinking in
Control--break,case,continue,default,do,else,for,if,return,switch,while⑹ Exception Handling--catch,finally,throw,throws,try⑺ modifier--abstract,final,native,private,protected,public,static,synchronized.trnasient,volatile⑻ operator--instanceof⑼ Creating Objects--new⑽ Reference--this,super⑾ method return type--voidReserved words for the Java language include: const and GOTOTo use the Java language keyword, b
Oo Thinking
Often see a lot of people complain about the configuration of Java ee/j2ee too complex, cumbersome, not easy to learn, in fact, the so-called simple and easy to learn depends on whether you have OO thinking mode.
Presentation layer interface form is usually some discrete data, that is, a single field data, through struts and other frameworks to provide actionform and tag library, these individual field data encapsulation and business lay
DoubleGetdiscount () {returndiscount; } //method for obtaining and setting the user's mailbox address PublicString Getemail () {returnemail; } Public voidsetemail (String email) { This. email=email; } //methods for getting and setting the user name PublicString GetName () {returnname; } Public voidsetName (String name) { This. name=name; }}CUSTOMER[0]cardid:c001Name:wangxywcost:2800.0discount:9.0Address:beijingEmail:[email protected]CUSTOMER[1]cardid:c002Name:xu Qu
, when the method is finished after the second age out of the stack, but the second age changed the value and print, does not affect the first , the main method continues to print the output age (at this time the first one); The reference data type creates a stack frame (array) when using array, points to the memory space in the heap, and then produces a stack frame (array), which is passed by the first array (address). It also points to the memory space in the heap, the second within the method
:---------------Characteristics:The function name is the same as the class nameDo not define return value typesThere is no specific return value, and the object is definitely returned after creation.If the class does not have a constructor defined, the JVM allocates an empty construct.If the class defines a constructor, there is no empty construct.Role:Initializes the object.Attention:The characteristics of the default constructor.Multiple constructor
, Feng small Java object-oriented programming thoughtObject-oriented three features: encapsulation, inheritance, polymorphismPackaging:Syntax: Property privatization (private), providing a way to provide relative get/set to access (public),The judgment of the business logic
. The most serious problem is that the study attitude is not correct, the work of plagiarism phenomenon, Ma Lun, Mao Provencale handed in the experimental report exactly the same, Wu Fangjuan students handed in the experimental report, the name is actually Tan Do, put forward serious criticism. In addition Lin Xiaowei students carefully and carefully, to their own learning experience also summed up in place, to give praise.In view of the above phenomenon, after the discussion of the TA group, th
Summary
5%
Four: summary1. Experimental summary: The main content of this experiment is the code object-oriented three elements of the application, as well as the code design ideas and testing methods, through this week and last week's PSP time ratio can be seen, the proportion of design and testing increased, and the code to achieve the proportion of time decreased, which is closer to dail
Person {private int age;//set Private member variable (property variable can only be set to private, local variable not) private String name;public void setage (int a) {//External provisioning member The method of the variable if (a This keyword:function: Used to distinguish between a member variable with the same name and a local variable (this. Member variable)Example: Judging if you are a peerclass Person {private int age;private String name;public int getage () {return age;} public void Set
understand the input and output, the legitimacy of identifiers, the definition of variables, and some of the same knowledge of C language, and so on, although not fully mastered, But also better than before, of course, mainly from the above examples to learn the loop control structure, the use of large numeric classes, one-dimensional arrays and multi-dimensional arrays and the use of irregular arrays, these programs for me or now fully understand still a little difficult, but I try to find inf
(list of references)
Anonymous inner class anonymous inner class does not have a class name, cannot have abstract and static properties, and cannot derive subclasses. The definition format for anonymous inner classes is:new Parent type name (list) {class Body}A sample is easier to understand:Abstract class ClassA {int data;public ClassA (int i) {data = i;} public abstract void Method (); public class ClassB {public static void main (string[] args) {ClassA a = new ClassA (3) {public void me
In object-oriented programming, there can be no further concept of the first step or the second step. "Objects and Classes""Relationships between classes and objects"A> Association Relationshipb> Inheritance Relationship (general and special)c> Aggregation Relationship (whole and part)d> Realization Relationship"Java a
, dependency inversion principle)
-we see that the code conforms to the OCP principle by adding a layer of abstraction. Code has a good extensibility, maintainability, the price is more code, inefficient.Design patterns beginners are prone to overuse them, leading to over-design, that is to say, complying with dry and OCP is certainly good, but will appear yagni (you aren ' t gonna need it and you won't need it) issues.The dry principle and the Yagni principle are not fully compatible. The
internal access, the lowest access level4). Default: Public only for classes in the same packageTwo principles of Encapsulation (approximate):1. Hide as many things as possible and provide a simple interface to the outside.The higher the system's package, the higher its relative independence, and the more convenient it is to use.2. Hide all the attributesIf a property is allowed to be accessed by the outside world, provide a public way to access the propertyWhy not define the volume property as
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.