In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to use EXT to simulate object-oriented java code, the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have some understanding of the relevant knowledge after reading this article.
Recently began to contact the AJAX framework-EXT, after learning, but also to record their own experience, see below.
1 、 namespace
EXT organizes class definitions in namespaces, just like the namespace of c # or the package of java. For example, define the namespace of the pojo class:
Ext.namespace ("Ext.domain"); JAVA code comparison: package Ext.domain
2. Class definition
As with javascript, use function to define classes (but here, the constructor is not described)
The code is as follows:
EXt.domain.Person = function () {}
3. Class member variable definition
You can use prototype to define member variables for a class, which, since prototype, is non-static. Ext.apply is a static method provided by the EXT framework that completes this definition.
The code is as follows:
Ext.apply (Ext.domain.Person.prototype, {name: "Zhang San"}); JAVA code comparison: private String name = "Zhang San"; public void setName (String name) {this.name = name;} public String getName () {return this.name;}
4. Class instance method definition
The code is as follows:
Ext.apply (Ext.domain.Person.prototype, {getDetails: function () {alert ("name: {0}, age {1}", this.name,this.age);}})
5. Class static method
The code is as follows:
Ext.domain.Person.getDetails = function (_ name,_age) {var _ person = new Ext.domain.Person (); _ person.name = _ name; _ person.age = _ age; alert (String.format ("name: {0}, age {1}", _ person.name,_person.age))
As you can see, you can use EXT to simulate object-oriented java code and become familiar with Java code.
On how to use EXT to simulate object-oriented java code is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.