Java technology in the new direction
Java technology come out of time has passed since nine years. As a concern has been the growth of its journalists, who for some time had the idea: "Java technology is now mature, and the pace of development is not slowed down a little it." However, this kind of thinking is wrong. Java technology has evolved significantly. Java technology is ushering "another revolution" turmoil. This is the conclusion.
"Another" mean? "Revolution" refers to what is? Look at the conclusions of it is definitely feel. In fact, the author is not to say that such a change, but "the driving force for change." What makes Java technology changes? Let us from this point of view, look at the history of the changes to Java.
Java is in a period of change
Recalling the development process of Java technology, people will sigh: 2004 to 2005 the changes so much, it can be said "the present" Java technology is the conversion period. Java technology from programming language (Java language), operating environment (JVM: Java Virtual Machine), the framework (Java API group), with the current level at every one taking place in both the tremendous changes.
(1) changes in the programming language
Java language standard to see obvious changes. In September 2004 the official version J2SE5.0 (J2SE: Java2 Platform, Standard Edition, the core Java technology runtime environment), the standard Java language in the Generics and metadata by a large margin expansion. There is considered "Since Java since the advent of the biggest changes in the standard language" (the United States Sun Microsystems). The language changes in the standard of many Java API to bring affected. Many enterprises API introduction of the new version are based on the metadata annotation (procedures recorded in the Additional Information), the shorter encoding accounts more information.
(2) changes in the Java runtime environment
In J2SE5.0, substantially strengthened the JVM management function and practicality, in other words, with the implementation of the Java OS (operating system) features. For example, in the original J2EE (Java2 Platform, Enterprise Edition, and build the Java Enterprise System technology) area, equipped with a standard management application software management framework JMX. Not only that, also equipped with self-monitoring capabilities JVM ((JSR 174: Monitoring and Management Specification for the Java Virtual Machine). Standard feature in the framework of the real-time monitoring of the JVM run-time status, that is, memory usage, thread status, and .
J2SE5.0 new additional features including parallel processing utility (JSR 166), which is based on New York State University Doug Lea provided by the library. In other words, the standard used in the procedures from the private library.
(3) changes in the framework of
Server-side Java framework has also undergone a great change. Enterprise Java technology - J2EE "use" note "J2EE Blueprint", will be made into Web application layer, layer EJB (Enterprise JavaBeans, including transaction processing, business process modular framework) to build ideas. These two levels ushered in the framework of the replacement period. Web layer with a new framework for JSF (JavaServer Faces, the modules will be combined to build a Web application framework), EJB layer as the standard programme which has just been published in the next generation EJB specifications "EJB3.0."
It is worth noting that contributed to changes in the framework of civil society is from the open-source software.
On the JSF as the impact of the open-source Web framework of the popular Apache Struts. Struts JSF is the idea of improving the product of the JSF Spec Lead (specifications developed leaders) of Craig R. McClanahan is the author of Struts.
EJB3.0 on the impact of open-source software is civil. EJB3.0 introduction of the DI (Dependency Injection, dependency injection) of containers (Container) and POJO (Plain Old Java Object) category lasting These new features and greatly reduce the complexity of programming. These concepts for PicoContainer, Spring and other open-source software into the eye-catching.
The background is that users of "the current EJB too complicated" criticism. EJB opposition originally proposed by the design and open-source software, has turned out to the central concept of EJB3.0, showing a huge influence.
(4) scripting language
Java technology in the new standard in the Groovy programming language (JSR 241). This is a language can be connected seamlessly with the Java scripting language, is expected to a very short deal with the relevant procedures have been completed. "Java technology in a language other than Java added," This sounds Perhaps some uncomfortable, in fact before there are such voices that will be able to take full advantage of Java technology resources as a script language use. Groovy was originally open-source software, the ultimate recognition, was adopted as the standard.
Can be seen from the above, the constituent elements of Java technology is undergoing tremendous changes. In the not too long ago, filed a Java server, "Servlet and JSP, EJB API is important" This note also dominated, but now based on JSF and EJB3.0 applications has become a "beyond recognition" procedure. In the short run procedures or tests, even there is not only the Java language, and even have begun scripting language called Java framework.
These changes from the point of view of the case, can be said to be further played a Java object-oriented advantage. Of course, but also improve development efficiency, improves stability, simplify operation and management, and other business advantages.
Development groups is the real "agents of change"
Well, the driving force behind these changes from where? Why do I say that the "present" is facing "another revolution"? The reasons are as follows:
Java technology in the development process, from 1999 to 2000 is a big turning point. J2EE concept appeared in 1999. J2EE is 2 to 3 years after the popular, but the technology system as early as five years ago has been established. In front of us, the contours of a new generation of Java technology is gradually emerged.
JCP (Java Community Process) 2.0 was introduced in 2000. Membership-based organization to promote the form of Java technology specifications development, while the overall development direction determined by the pattern. Thus not dependent on the specific formulation of the specifications of enterprise processes. After the organizational form of the past five years, gradually developed into "agents of change."
J2EE Prior has been plagued by criticism that the "Web EJB layer and much of the gap," "EJB too complicated," but it is also because this is a practical use of technology. JCP also face a lot of criticism, claiming that he "was not entirely open," and "the development of technical standards is inconceivable to allow Sun ownership of intellectual property rights," but as a group JCP has continued to grow and develop.
Direct promotion of Java technology changes for the actors formed five years ago based on the standard-setting process groups - JCP, but the real technology will be discussed and included in it is the JCP, including Java technology, many critics Java developer community. They also carried out early pioneer of Java technology changes. This will be the birth of the next generation of technology in two to three years after gradually spread to the mainstream business users.
Java technology "agents of change" for the developer community. Not subject to specific enterprises, through numerous Java developers need the recommendations, Java technology is constantly
Several Portal Technology Review and Comparison
BEA WebLogic Workshop for staff development platform for the entire enterprise to establish BEA applications, both with WebLogic Portal 8.1 business logic. Sun Java System Portal Server has the strongest technical foundation and standards support, including security and mobile applications, but it needs the establishment and maintenance of Java skills.
Microsoft SharePoint Portal Server 2003 to set up a portal, and when used in conjunction with Office 2003 users the best experience, but it's standards support than other portal so sound.
OracleAS Portal 10g from a simple database application development as a gateway to mature, has good management and a strong mandate, it will be content to the different positioning of the audience.
Vignette has announced the Application Portal 7.0 has a proven J2EE framework that allows the user to recover in the investment application server, and its ease of management and application packages enable users to quickly implement portal.
Two previously tested the gateway also right to stack together. IBM WebSphere Portal to the recent injection of additional platform support, improved content management and increased operating JSR 168 small portal capabilities. Although it was not formally re-testing, but we feel that these changes to WebSphere Portal 5 close to the other top portal products.
Plumtree is the traditional gateway to the leading manufacturer of pure, and still maintained the overall first position. Although Plumtree products according to each user as one of the most expensive products, but the majority of tests have been a top rating: easy integration with other applications, which means that IT cost reduction, but it is actually the highest return on investment products.
If At first glance did not find the perfect portal solutions are also not disappointed, the situation often is the case. Several of the above products close to the evaluation showed that the area of application in the portal, there is no absolute leader. In fact, some of the most successful portal is a combination of several vendors use the technology to gain a true customization. All the different portal on the surface, there are also similarities, once the understanding of these similarities, portals can become so complex technology infrastructure play a greater role in one of the best ways.
Mobile newspapers billing strategies
Billing means each value-added business is a necessary means to achieve gains, the market is an important factor for success. Billing poor design market participants will enter the vicious price competition, what is more likely to lead to the destruction of the entire market, the damage to the interests of industry. Billing excellent design, based on the needs of users, the actual mental capacity, use price leverage to secure the old user base, develop new user groups, thus achieving the industry healthy and orderly development of a virtuous. Below the author on the current progress of the mobile phone billing newspaper design and we make a study.
1, billing targets Member billing: access by users in accordance with the relevant information and facilitation services according to certain rules corresponding to pay the costs. This detailed billing should be as simple as possible and easy for people to accept services.
Enterprise Billing: enterprise in accordance with their needs, so that specific layout or columns to the specific group of people and opening up, according to certain rules at the same time pay the corresponding fees. Government agencies may also follow this law, the use of mature cell phone platform to the public release of information related to public interest, according to certain rules at the same time pay the corresponding fees.
Second, billing forms of billing newspapers phones now there are mainly two ways: First, pay-per-view, such as SMS, MMS, as well as some voice services; second, from the flow of billing, such as WAP version of the cell phone reported that the version of JAVA metacarpal letter to the mobile phone. MMS, SMS mobile phone subscribers reported in the more complex nature of news to many different subscribers, the cost of such relatively high, access to the news content will not be too much. Billing is by flow mobile data services billing the basic method is cost-oriented or technology-oriented, not customer-oriented or demand-oriented programmes of the charges. Flow on the users, is the background of things, not the perception, even professionals can only use cell phones calculated immediately send or receive a specific size, 1 million of a 256-color bitmap mode image can produce such a great flow. This uncertainty caused by billing mobile phone users will bring conflict with the newspaper, not conducive to the promotion of the business.
At present, voice services, Internet access, in accordance with the long calculated, and has been a user acceptance. Therefore, the mobile Internet billing model may also be used. Networking is relatively users will be able to experience, and it is most easily measured both variables. Tariff programme is good or bad, an evaluation criterion is whether the user-friendly understanding, enabling users to dispel doubts on the business operators to have the trust, thereby willing to use the business.
Third, set up with the package of services provided by mobile media is becoming more diverse content to the user and the feelings of First brilliant Then dazzling. Mobile media operators in order to better promote the services must consider some of the services will be bundled package provided to users. Now the phone is common practice newspaper columns by monthly subscription price of a column, this convenient mobile newspaper publishers gains. But for users, a section only to see a type of news, we should note that a number of types of columns must repeatedly subscribers, it will naturally cost more than the psychological ability of users, the ultimate impact of mobile phone or the newspaper publishers receipts. Accumulation technology introduced palm-point letter to a different pricing strategy, introduced in the news at this stage is relatively simple type (basic are news content), the contents of the overall package of all eight yuan a month, after the subscription Then according to their own preferences choose to download. Such costs can be accepted by the user, the user at the same time meet the needs of personalized news, an increase of users attractive, enhance brand competitiveness.
However, all the services will be packaged into a package, launched a month, Bao Bao, or even life, and this is just a rough set of the package, mobile phone newspaper is the price of the initial development price strategy can not meet future mobile media services diversification . Therefore, the meticulous study of the package and should be carefully introduced each mobile media operator compulsory.
Price should not be a comprehensive package distribution in the target population is low-end users. This number of users relative to demand more flexible prices, in accordance with the "large amount" to select telecommunications and consumer products. Tariff Package design goal, and that is to find the current structure of the user "level" of the general, and in accordance with an enterprise's financial situation and profitability objectives appropriate to be neutral, thus pushing the target market. In the high-end users of telecommunications products general lack of demand elasticity. Therefore, the level design package, it will affect their income, their shackles.
Users found in "line" roughly where point, mobile media operators should be as a centre operators under their own user structure, financial situation, a combination of factors such as profit targets to consider the design. In the actual launch, but also under the enterprise's financial situation and profitability objectives appropriate to be neutral, to continuously improve in the target market. This, however, are in a rational competitive environment, without any rational simple price cuts will be carefully designed package at their own expense and at a Qilianbala. Therefore, the mobile media operators in a series of charges set at the same time, we must always pay attention to the prices of competitors strategy, through the pricing lever firmly adhere to the target population.
Ajax traps (Ajax Gotchas)
Ajax trap
Ajax is an awesome technology that is driving a new generation of web apps, from maps.google.com to colr.org to backpackit.com. But Ajax is also a dangerous technology for web developers, its power introduces a huge amount of UI problems as well as server side state problems and server load problems.
Ajax is an important technology, it will lead the next generation of web application development trend, then backpackit.com colr.org to maps.google.com, is full of the ajax Qingying. But for web developers, the ajax is a dangerous technology, it has also led to the strength of a lot of UI issues, such as the issue of server-side and server load problems.
I've compiled a list of the many mistakes developers using Ajax often make. Javascript itself is a dangerous UI technology, but I've tried to keep the list to problems particular to Ajax development:
I edit a ajax developers in the use of the mistakes committed during the regular list. Javascript itself is a dangerous UI technology, but I still make as much as possible the list contains only ajax encountered in the development of the problem, and remove swap Javascript itself.
Mistakes:
Error:
Not giving immediate visual cues for clicking widgets. If something I'm clicking on is triggering Ajax actions, you have to give me a visual cue that something is going on. An example of this is GMail loading button that is in the top right. Whenever I do something in GMail, a little red box in the top right indicates that the page is loading, to make up for the fact that Ajax doesn't trigger the normal web UI for new page loading.
Click Control is not promptly after the visual messages. If I click on this thing ajax triggered an action, then you have to give me a visual reminder, I told some action is being implemented. One example is the upper right hand corner of Gmail pages loaded button (loading button). No matter when, when I Gmail operation in the implementation of any page on the upper right hand corner of the red button I will be tips, pages are loading. This obvious to the user Note that your actions, thereby overcoming ajax no longer override the user pages and I do not know whether the operation of the inconvenience.
Coofucoo say:
Habits can be cultured. Just as users used to use windows, which will be used to the "Start" button, though the beginning they will ask: "Why I would like to shut down, but also from the 'Start' began?." When the majority of web pages users are accustomed refresh means that the data are submitted to the traditional concept, once you break this concept, you must be careful, as many prompts the user to your current operation, the user does not feel bewildered, "in the end that the procedures in this damned doing ??!!"。 Negative examples you can find Qiuqiu the blog.
Breaking the back button The back button is a great feature of standard web site user interfaces. Unfortunately, the back button doesn't mesh very well with Javascript. Keeping back button functionality is a major reason not to go with a pure Javascript web app.
Coofucoo say:
This is Yingshang seems to be no solution. I think the current solution is in their own procedures, to provide a back button, and to replace the browser button. But I am afraid that this will increase the workload.
Undermine back button functions. Back button web user interface standards, a very important function. But unfortunately, the back button combination of function and Javascript is not good. Keep back button function is we do not use pure Javascript web applications reasons.
Changing state with links (GET requests) As I've referenced in a previous posting, Ajax applications introduce lots of problems for users who assume GET operations don't change state. Not only do state changing links cause problems for robots, users who are accustomed to having links drive navigation can become confused when links are used to drive application state changes.
Links to convert even with the state? (GET send requests), as I mentioned earlier, some believe that the operation will not change GET state users, the ajax applications led to a lot of problems. Can change the status of those links not only lead to the use of web applications habits change, which makes it easy to think that the habit of navigation links is the most use from the users feel very confused.
Coofucoo say:
Feeling of this place a bit difficult to understand, explain. Hyperlinks to the most primitive function is to switch between pages, you click on a page from a hyperlink, will be taken to another place. After hyperlinks to develop, GET method can be used to send some data server, but some users still think that is the function of hyperlinks from the role of navigation. But now the situation has changed, ajax, due to the large scale introduction of Javascript, so an ordinary hyperlinks can also play the original button can play a role, such as in the asp.net linkbutton. This may be more powerful, but has given some of the habits and users about the changes, the problem will be introduced.
Blinking and changing parts of the page unexpectedly The first A in Ajax stands for asynchronous. The problem with asynchronous messages is that they can be quite confusing when they are pop in unexpectedly. Asynchronous page changes should only ever occur in narrowly defined places and should be used judiciously, flashing and blinking in messages in areas I don't want to concentrate on harkens back to days of the html blink tag.
Pages may be a part of a surprisingly, the Yizhawen to change. Ajax this group of acronyms in the first letter "A" on behalf of "asynchronous (asynchronous)." Induction of the problems brought about by the information that they will be quietly implementation, there is no sign of a sudden pop up, people feel very confused. Asynchronous pages of the changes should be carefully designed, made it clear that the wise use, suggesting that the information should be placed in those places I will not concentrate, and use this technology such as blink marking his flashing up.
Not using links I can pass to friends or bookmark Another great feature of websites is that I can pass URLs to other people and they can see the same thing that I'm seeing. I can also bookmark an index into my site navigation and come back to it later. Javascript, and thus Ajax applications, and can cause huge problems for this model of use. Since the Javascript is dynamically generating the page instead of the server, the URL is cut out of the loop and can no longer be used as an index into navigation. This is a very unfortunate feature to lose, many Ajax webapps thoughtfully include specially constructed permalinks for this exact reason.
Hyperlinks become meaningless, it can not transfer to a friend or collection. Another important function of the web site is a URL you can be transmitted to another person, and he will see you through this URL to see things. Of course, I can also put the URL of my favorites, so I visited him after. Javascript, including Javascript based on the ajax application of this technology will bring enormous challenge mode. Since Javascript replaced the server, used to produce dynamic data, not the specific URL on behalf of the entire interactive cycle of a state, it can no longer holds. This aspect of the loss is very regrettable that many ajax web applications in this regard to consider very carefully, including specialized construct a special link (permalinks) to deal with such a situation.
Too much code makes the browser slow Ajax introduces a way to make much more interesting javascript applications, unfortunately interesting often means more code running. More code running means more work for the browser, which means that for some javascript intensive websites, especially poorly coded ones , you need to have a powerful CPU to keep the functionality zippy. The CPU problem has actually been a limit on javascript functionality in the past, and just because computers have gotten faster doesn't mean the problem has disappeared.
Too much of the code for the browser has become slow. Ajax brought a very interesting javascript application, but, unfortunately, it means more interesting code at runtime. More code means that the browser do more work, in particular some bad code While strengthening the function, but you need to have a robust CPU to support the realization of these functions. CPU is actually strong enough restrictions javascript function in the past an important factor, and even if the current computer has become more and more rapidly, the problem has not completely disappeared.
Inventing new UI conventions A major mistake that is easy to make with Ajax is: 'click on this non obvious thing to drive this other non obvious result'. Sure, users who use an application for a while may learn that if you click and hold down the mouse on this div that you can then drag it and permanently move it to this other place, but since that's not in the common user experience, you increase the time and difficulty of learning your application, which is a major negative for any application .
UI used to create new habits. Use ajax very easy to be wrong: "granted the request of users click on a hidden things, and then a visible results back to the local user." Indeed, when a user of your procedures for a period of time, he can understand, if he will be in a mouse click on the region, and to maintain the state of press drag on this region can be moved to another permanent location. But these experiences are not born each user will know, if you do this, then you for your users learn how to use your application to increase the difficulty and time, and this is the case for most applications, are extremely the negative impact.
Not cascading local changes to other parts of the page Since Ajax / Javascript gives you such specific control over page content, it's easy to get too focused on a single area of content and miss the overall integrated picture. An example of this is the Backpackit title . If you change a Backpackit page title, they immediately replace the title, they even remember to replace the title on the right, but they don't replace the head title tag with the new page title. With Ajax you have to think about the whole picture even with localized changes.
When local changes, may need some other pages, manifested synchronization. From Ajax / Javascript gives you control (change) the specific content pages, are particularly vulnerable committed only partial data on changes in the entire page and forget the synchronous changes mistake. One example is the Backpackit (www.backpackit.com) title. If you implemented a change Backpackit pages action, the title will be immediately reversed, or even the right of the heading will be a change, but they forget that for a new page in synchronization <head> labels in the <title> marker. In ajax, when you change local, you need to consider the whole page synchronization.
Asynchronously performing batch operations Sure with Ajax you can make edits to a lot of form fields happen immediately, but that can cause a lot of problems. For example if I check off a lot of check boxes that are each sent asynchronously to the server, I lose my ability to keep track of the overall state of checkbox changes and the flood of checkbox change indications will be annoying and disconcerting.
Asynchronous operation batches implementation of the problems brought about. Indeed, in ajax, you can edit many different forms, and the timely submission of the form will be, but it has also brought a lot of problems. For example, I edited some of some box, each individual can be asynchronous data will be submitted to the server, but at the same time I lost in the overall state control of the capacity of these boxes, and each box to the and then returned to the results of the information that will become very unpleasant.
Scrolling the page and making me lose my place Another problem with popping text into a running page is that it can effect the page scroll. I may be happily reading an article or paging through a long list, and an asynchronous javascript request will decide to cut out a paragraph way above where I'm reading, cutting my reading flow off. This is obviously annoying and it wastes my time trying to figure out my place.
Another problem is that immediately to a running into the content pages could lead to rolling pages. I might like to read a full article indicated, although the article may be very long. But an asynchronous javascript procedures Perhaps I will read the part of the loss to affect my reading. When I try to read before I again find the location, such a mechanism would be particularly inconvenient.
In addition, some programming issues:
Furthermore, there is some programming issues:
Be careful about what you expose on the server, especially if you're using remote-stub frameworks like SAJAX. You can't necessarily let Javascript use generic services that you might let a server-side script call. Don't rely on a global XMLHttpRequest object. See Call Tracking.
Coofucoo say:
I did not translate this place out of the situation that he described was not very precise. Which know what was coming notice.
Be careful about changing the DOM in one call, such that when a later call returns, it ends up writing a value into the wrong DOM object - or perhaps the DOM object doesn't return at all (To be added to [Call Tracking ).
When you respond to a call to change the contents of DOM, we must be careful at this time of a later call to return, is likely to result in the wrong data into the DOM object, or might lead to the operation of the DOM object is not return.
Consider the effects of a call never returning. You can establish a timeout mechanism by setting a timer as soon as the call is made (with Javascript's ontimeout function). The timer can explicitly call the request's abort () method if no return has occurred, and inform the user accordingly.
Consider the situation did not return calls. You can call the function after the establishment of a timer (in the ontimeout Javascript function) to the establishment of a mechanism for overtime. If there is no return, this timer can be clearly implementation abort () (termination of operation), and notify the user.
Consider the effects of a call returning with an error status - perhaps alert the user somehow. A pattern like Synchronisation Status helps here, to alert the user that some data is stale.
Consider calling a mistake to return to the state, such a situation may prompt the user some baffling information. Synchronisation Status like this can be a model for us here to help, some data have been warning users of the problem.
Retrieved from "http://www.ajaxpatterns.org/Ajax_Gotchas"
Address quote: "http://www.ajaxpatterns.org/Ajax_Gotchas"
SCJP exam that 310-025 (a)
This is the original SCJP examination that is the 1999-2000 period! Provided to the reference to test SCJP!
I am also a number of other, and if all possible print over 100 pages (double-sided) look! I will be here in the paste out! (If any), the total is divided into several! This first set of only 19 that , a bit more than other sets, the more than 300 that have, I have summed up, my colleague said after reading it, the examination will not be a problem, so I collect so much, I see the big, issued to the everyone sharing, attention please!
1. Which statement are characteristics of the>> and>>> operators.
A.>> performs a shift
B.>> performs a rotate
C.>> performs a signed and>>> performs an unsigned shift
D.>> performs an unsigned and>>> performs a signed shift
E.>> should be used on integrals and>>> should be used on floating
Point types
C.
2. Given the following declaration
String s = "Example";
Which are legal code?
A. s>>> = 3;
B. s [3] = "x";
C. int i = s.length ();
D. String t = "For" + s;
E. s = s + 10;
CDE.
3. Given the following declaration
String s = "hello";
Which are legal code?
A. s>> = 2;
B. char c = s [3];
C. s + = "there";
D. int i = s.length ();
E. s = s + 3;
CDE.
4. Which statements are true about listeners?
A. The return value from a listener is of boolean type.
B. Most components allow multiple listeners to be added.
C. A copy of the original event is passed into a listener method.
D. If multiple listeners are added to a single component, they all must
All be friends to each other.
E. If the multiple listeners are added to a single component, the order
[In which listeners are called is guaranteed].
BC.
5. What might cause the current thread to stop executing.
A. An InterruptedException is thrown.
B. The thread executes a wait () call.
C. The thread constructs a new Thread.
D. A thread of higher priority becomes ready.
E. The thread executes a waitforID () call on a MediaTracker.
ABDE.
6. Given the following incomplete method.
1. Public void method () (
2.
3. If (someTestFails ()) (
4.
5.)
6.
7.)
You want to make this method throw an IOException if, and only if, the
Method someTestFails () returns a value of true.
Which changes achieve this?
A. Add at line 2: IOException e;
B. Add at line 4: throw e;
C. Add at line 4: throw new IOException ();
D. Add at line 6: throw new IOException ();
E. Modify the method declaration to indicate that an object of [type]
Exception might be thrown.
CE.
7. Which modifier should be applied to a method for the lock of the
Object this to be obtained prior to executing any of the method body?
A. final
B. static
C. abstract
D. protected
E. synchronized
E.
8. Which are keywords in Java?
A. NULL
B. true
C. sizeof
D. implements
E. instanceof
DE.
9. Consider the following code:
Integer s = new Integer (9);
Integer t = new Integer (9);
Long u = new Long (9);
Which test would return true?
A. (s == u)
B. (s == t)
C. (s.equals (t))
D. (s.equals (9))
E. (s.equals (new Integer (9))
CE.
10. Why would a responsible Java programmer want to use a nested class?
A. To keep the code for a very specialized class in close association
With the class it works with.
B. To support a new user interface that generates custom events.
C. To impress the boss with his / her knowledge of Java by using nested
Classes all over the place.
AB.
11. You have the following code. Which numbers will cause "Test2" to be
Printed?
Switch (x) (
Case 1:
System.out.println ( "Test1");
Case 2:
Case 3:
System.out.println ( "Test2");
Break;
)
System.out.println ( "Test3");
)
A. 0
B. 1
C. 2
D. 3
E. 4
BCD.
12. Which statement declares a variable a which is suitable for
Referring to an array of 50 string objects?
A. char a [][];
B. String a [];
C. String [] a;
D. Object a [50];
E. String a [50];
F. Object a [];
BCF.
13. What should you use to position a Button within an application
Frame so that the width of the Button is affected by the Frame size but
The height is not affected.
A. FlowLayout
B. GridLayout
C. Center area of a BorderLayout
D. East or West of a BorderLayout
E. North or South of a BorderLayout
E.
14. What might cause the current thread to stop executing?
A. An InterruptedException is thrown
B. The thread executes a sleep () call
C. The thread constructs a new Thread
D. A thread of higher priority becomes ready (runnable)
E. The thread executes a read () call on an InputStream
ABDE.
Non-runnable states:
* Suspended: caused by suspend (), waits for resume ()
* Sleeping: caused by sleep (), waits for timeout
* Blocked: caused by various I / O calls or by failing to get a monitor's
Lock, waits for I / O or for the monitor's lock
* Waiting: caused by wait (), waits for notify () or notifyAll ()
* Dead: Caused by stop () or returning from run (), no way out
15. Consider the following code:
String s = null;
Which code fragments cause an object of type NullPointerException to be
Thrown?
A. if ((s! = Null) & (s.length ()> 0))
B. if ((s! = Null) & & (s.length ()> 0))
C. if ((s == null) | (s.length () == 0))
D. if ((s == null) | | (s.length () == 0))
AC.
16. Given the following method body:
(
If (sometest ()) (
Unsafe ();
)
Else (
Safe ();
)
)
The method "unsafe" might throw an IOException (which is not a subclass
Of RunTimeException). Which correctly completes the method of
Declaration when added at line one?
A. public void methodName () throws Exception
B. public void methodname ()
C. public void methodName () throw IOException
D. public void methodName () throws IOException
E. public IOException methodName ()
AD.
17. What would be the result of attempting to compile and run the
Following piece of code?
Public class Test (
Static int x;
Public static void main (String args []) (
System.out.println ( "Value is" + x);
)
)
A. The output "Value is 0" is printed.
B. An object of type NullPointerException is thrown.
C. An "illegal array declaration syntax" compiler error occurs.
D. A "possible reference before assignment" compiler error occurs.
E. An object of type ArrayIndexOutOfBoundsException is thrown.
A.
18. What would be the result of attempting to compile and run the
Following piece of code?
Public class Test (
Public int x;
Public static void main (String args []) (
System.out.println ( "Value is" + x);
)
)
A. The output "Value is 0" is printed.
B. Non-static variable x cannot be referenced from a static context ..
C. An "illegal array declaration syntax" compiler error occurs.
D. A "possible reference before assignment" compiler error occurs.
E. An object of type ArrayIndexOutOfBoundsException is thrown.
B.
19. What would be the result of attempting to compile and run the
Following piece of code?
Public class Test (
Public static void main (String args []) (
Int x;
System.out.println ( "Value is" + x);
)
)
A. The output "Value is 0" is printed.
B. An object of type NullPointerException is thrown.
C. An "illegal array declaration syntax" compiler error occurs.
D. A "possible reference before assignment" compiler error occurs.
E. An object of type ArrayIndexOutOfBoundsException is thrown.
D.
I use PDF output statements iText practice
I use PDF output statements iText practice
Recently, work, the output PDF format used iText statements, iText familiar with the process of applying, here to share with you.
IText text output as a java source code, providing PDF, Html, Rtf variety of file formats, such as the output function. For the output of the text provides a good package. The PDF output statements, which only used a small open-source code as a whole a very small part. Include:
1, the PDF file output element 2, PDF documents Some of the settings 3, the output of four Chinese table settings Below, I will make four, I use on January 1 in the process of feelings.
1. PDF file output elements of the first, as the most basic program design practice, the most classic example is still Hello World, the most, I am also a Hello world output. Code like this:
Package com.lowagie.examples.general;
Import java.io.FileOutputStream;
Import java.io.IOException;
Import com.lowagie.text .*;
Import com.lowagie.text.pdf.PdfWriter;
/ **
* Generates a simple 'Hello World' PDF file.
*
* @ Author blowagie
* /
Public class HelloWorld (
/ **
* Generates a PDF file with the text 'Hello World'
*
* @ Param args no arguments needed here
* /
Public static void main (String [] args) (
System.out.println ( "Hello World");
/ / Step a: creation of a document object -
Document document = new Document ();
Try (
/ / Step b:
/ / We create a writer that listens to the document
/ / And directs a PDF-stream to a file
PdfWriter.getInstance (document, the new FileOutputStream ( "HelloWorld.pdf"));
/ / Step c: we open the document
Document.open ();
/ / Step d: we add a paragraph to the document
Document.add (new Paragraph ( "Hello World"));
) Catch (DocumentException de) (
System.err.println (de.getMessage ());
) Catch (IOException ioe) (
System.err.println (ioe.getMessage ());
)
/ / Step e: we close the document
Document.close ();
)
)
See a PDF file output, a total of only five steps needed to create a Document a. examples Document document = new Document ();
B. Document will be examples and documentation output streams of bundled together with PdfWriter PdfWriter.getInstance (document, the new FileOutputStream ( "HelloWorld.pdf"));
C. open the file document.open ();
D. Add text in the document document.add (new Paragraph ( "Hello World"));
E. close the document document.close ();
This five steps, we can generate a PDF file of the.
The key is two steps 2 and 4, and the second step, we will be a well-known document flow bind to the PDF files, the first of four road to documents added some words, in these two minor steps changes to a Pdf files can be done out.
2. PDF document as a statement of a number of settings, the regular circumstances, the need to print out statements, which involves a set of pages, as the statements of the PDF files, printers must be suitable for print output. Here, I have two statements, PDF files set to A4 size pages:
Rectangle rectPageSize = new Rectangle (PageSize.A4); / / definition of A4 size pages / / rectPageSize = rectPageSize.rotate ();// This can be achieved with the A4 pages Transverse Document doc = new Document (rectPageSize, 50,50,50,50); / / The remaining four parameters, set up a page four border
IText API documentation available, we can see that the size of Rectangle in the provision of custom settings, can spread like a PageSize attribute, which provides several common page style, if necessary, can go to the iText API file enquiries.
Here, we can make a size to meet the requirements of the Pdf files.
3. Chinese output of java may be due to historical issues, and may be due to this source code is a foreigner done, inevitable, the Chinese output, we have to do some things.
In order to solve the problem of Chinese exports, the need to download a package called iTextAsian.jar the JAR. Inside this package with the Chinese definition of a number of documents related to the output.
In order to output Chinese, I used the following statement:
BaseFont bfChinese = BaseFont.createFont ( "STSong-Light," "UniGB-UCS2-H" and BaseFont.NOT_EMBEDDED);
Font FontChinese = new Font (bfChinese, 12, Font.NORMAL);
Paragraph par = new Paragraph ( "Hello World" FontChinese)
Document.add (par);
The first line, the definition of a Chinese font basis, the second line with the basis of this Chinese fonts examples of a type font, the third line, type font used in a paragraph, fourth line, will be added to the paragraphs of text file.
In these firms, we first concern is often the first line of "STSong-Light", the definition of the use of the Chinese font, iTextAsian.jar provided several documents available fonts, properties are at the end of documents.
We have to take note that the first line of "UniGB-UCS2-H", the definition of the text coding standards and style GB we all know, is representative of H horizontal characters, V representative Shubai word iTextAsian.jar document by the end of the cmap Several documents are on the coding and pattern definition.
These two places are filled out documents without extension names, the two local languages you need parameters, we can allow Chinese to meet the needs of your normal output of the situation.
Here iText is necessary to point out a feature of the error, there will be no tips, will be dancing the part of the past mistakes, for example, in the absence of the Chinese fonts Chinese output circumstances, the Chinese part of the paragraph is blank , another example: If a document of some mistakes, the same output or PDF files, but the entire document is blank. The FEC, I have not yet found a better way of his investigation and only his own code.
4. Forms of the above settings through those, I can have a normal Chinese exports, coupled with some suitable form can be a very good output of the PDF statements.
To a clear, iText in a document (Document), there are many forms (PdfPTable), there can be many a table cell (PdfPCell), a cell can be put inside many paragraphs (Paragraph), a paragraph Some text can be put inside.
It should be noted here is not to the concept of a direct form inside cells directly put, if a three tables into six cells, then it is two lines of the form.
The second is to the attention of the local, if one of the three most basic forms Add to the five did not set out any inter-cell, forms will be wrong, as said earlier, forms add less than fundamental documents, and will not have any tips.
The following code can achieve a three to three forms:
PdfPTable table = new PdfPTable (3);
For (int i = 0; i <9; i + +) (
PdfPCell cell = new PdfPCell ();
Cell.addElement (new Paragraph ( "aaa"));
Table.addCell (cell);
)
For a form, the other often use to cross-out is a problem, here, as long as PdfPCell targets will be set examples of inter-out figures on it. As follows:
Cell.setColSpan (3); / / Note that this cell on the equivalent of three cells added to the table
In statements, and sometimes will encounter great form, if you wish to visit the second page, can still see the table on the need to use the first form of the first set, a simple example of the type called PdfPTable setHeaderRows ( ) method can be set on the first form of a few lines. As follows:
Table.setHeaderRows (2) / / set up the first of the two forms to the attention of the head here is, if you set a n will form the first, but the final outcome, or to form just is not enough n n trip circumstances, form will be wrong, resulting in the entire form could not write the document.
Here, and those who use the above technologies, we have completed a simple statement of the iText related categories, more than related aspects. In the article, it is impossible for 11, if needed can be found in the following address iText API documentation and tutorial.
Http://www.lowagie.com/iText/tutorial/index.html (iText tutorial)
Http://www.lowagie.com/iText/download.html (iText core packages)
Http://sourceforge.net/project/showfiles.php?group_id=15255&release_id=167948 (iTextArea packet)
[Job is reposted] you are still using if ele?
[Job is reposted] you are still using if else?
Panchiao里人http://www.jdon.com 2006/1/11 (reproduced retained)
Process-oriented design and object-oriented design is the main difference: whether the use of lengthy Yewuluojiceng if else judgement. If you are still widely used if else, of course, except the interface layer performance, even if you use Java / C # this fully object-oriented language, that you can only stay in the traditional thinking of the process-oriented language.
Analysis of traditional thinking habits
Why Yewuluojiceng use if else, the fact is the purpose of users to reuse, but this is the reuse process-oriented programming, programmers can only see code reusability, because he had seen several circumstances if else most of the code are repeated, only different individual, the use of code duplication can be avoided if else, and think that this is template Template mode.
He is wrong Fan: programmers only from the running order of the code in this direction to look at the code, such thinking similar pipes or serial circuit, water mains along the flow (code running order), there are several charge (a tube), in charge of several assigned to the mobile, met here at the code if else has.
And the use of OO, the first to break the code from running down in the same order when the order allowing this rule, and allowing the implementation of the code structure was not decided by what decision? OO design by the design of these models will be replaced if else, but always by a final such as the Service in accordance with the operating sequence assembly of these OO module, only one, which may include services, general Service is, in the EJB Session bean.
Once demand changes, we may be more in various OO Service Module, or even only changes in the Service Module OO implementation of the order will be able to meet the demand.
Here we also see OO separation of ideas, the language will be a process before Main function completely biodegradable, and will run code sequence separated from other logic, and not as chaotic as the process-oriented together. So it was mixed feelings, OO is to the order, which is in the affirmative, and the key is to separate operation of the order separated.
Are there can be seen if else do you have running order from home.
Design Mode entry point
Often reflect the design model is good, but I find it difficult to use, in fact if you use if else to write code (except Display Control outside), the business logic is written, but the use of simple language to the judgement of the situation as a reality the alternative.
We are familiar with or to the forum posts, for example, such as ForumMessage is a model, but the actual posting of two properties: the theme paste (a root paste), and to verify the (previous posting to the posts), there is a simple solution :
The establishment of a ForumMessage, and then joined isTopic ForumMessage statement that a judgement, attention to you here attribute the judgement of a simple introduction, the procedure may lead to other parts of your presence everywhere if else judgement.
If we switch to another realization of ideas to the concept of object-oriented view, the actual theme in the paste and verify that the two objects, but most of these targets is the same, I will, therefore, expressed as a theme ForumMessage stickers and create a subclass inheritance ForumMessage ForumMessageReply as replies, so, I place in the process, such as Service, I have determined that the Model is to verify, I will direct the ForumMessageReply can be traced back to this release is similar to Collection Remove all objects, and the mandatory conversion. Through this means I eliminate the proceedings after the judge sentences if else may arise.
From embodied here, and if analysis of the wrong direction would lead to the misuse of mode.
Discuss design patterns, for example, can not do business context of the case scenarios, not to decide whether the mode, the following comparison cite two examples:
1. To the posting of the code, for example the first case is not the context of the article, that there is a code only:
Main () (
If (case A) (
/ / Do with strategy A
) Else (case B) (
/ / Do with strategy B
) Else (case C) (
/ / Do with strategy C
)
)
?
This code simply code, no business functions, therefore, in such circumstances, we will have a difficult determining that the use of the mode is with a certain strategy mode, or use if else can not escape the fate of the design model is not magic and can not be a section of the code has become meaningless simple, and can only be embodied in the business functions can be more easily expanded.
The second in this posting, the author cited an PacketParser business case, this code is embodied business functions, is a data packet analysis, the authors also compare different models use different, we still use Dynamic Proxy mode Command mode or to eliminate those that may exist if else
The above two examples demonstrate: We use the business logic design pattern is the starting point, and decomposition of business logic, we may use habits if else to realize that when you have such an attempt has been achieved or code, then they should be Refactoring consider the need for the reconstruction.
If else alternatives
Then a real war, which design patterns can be replaced if else? In fact GoF design patterns can be used as a substitute if else, we were described as follows:
?
Public class Order (
Private int status;
/ / Note:
/ / = 1 status but said orders for the Show;
/ / Status = 2 Show that has been pending;
/ / = 3 status that has been dealing with payment
/ / Status = 4 that had already paid Unfilled
/ / Status that has been shipping = 5
)
Design of the above categories is undoubtedly will be used as a function of the traditional language to use, this process resulted in a large number of code if else.
So, if you really can think of any way, you can use filters, filter as a firewall to better understanding of the client when there is a request, the nature of different firewall, the firewall is to intercept port; that firewall security checks is to intercept, and so on. Filters also like all kinds of red-blue filters; red filter only through a red light in the interception; blue light filters to intercept down in the blue, which is actually light for use if else decomposition.
Figure through a filter conditions we were able to make a three-dimensional separation of the signal, if you use if else that you will map the conditions of 1/2/3/4 combined, in the same place Conditions judgement.
Filter requires in-depth understanding of the details and the realization of small differences, please refer to the article: AOP vs Decorator
OO design summary
There is also a pseudo-mode, although the use of such a model state, but in reality is the use of internal models if else, or switch to an important condition for the state switching or judgement, then no doubt that further efforts were needed. More importantly, the model can not be self-proclaimed, and a book showing people.
Object-oriented real grasp these ideas is a difficult thing, there are all kinds of hair Jiuzhuo their upward Stubbs captions, are Wurenzidi, therefore, I think that beginners read Thinking in Java (Java programming ideas) no use, it tried to level terms from OO programming language ideology, have failed miserably, as the language reference books can be, but as a Java OO embodied in the thinking of learning materials, be wrong.
OO programming methodology is a kind of thinking, if there is no comparison methodology is unable to understand the characteristics of this methodology, ancient Zen is a methodology, Wushan is all carried water on these applications can of chopped wood.
What is so OO thinking can be applied to the experience? GoF design pattern is, GoF design model is the software equivalent of all carried water and other basic living chopped wood, so that if a programmer does not have even the basic living, the self-proclaimed why he OO programmers? OO programming professionals engaged in the design work, if we do not grasp basic skills design patterns, as a monk who do not want to do all carried water chopped wood, and why he based this industry? Has long been masters downhill rush.
Concluded: if else will be used in small areas can be, such as a simple numerical judgement, but if you accordance with the traditions and customs of thinking in the implementation of business functions also use if else, then thinking that you may need remodeling, you Programming experience more rich, the traditional mode of thinking process can be easily rooted and seeks to change its very difficult to accept the proposed storm-minded professional training.
Summed up in one sentence: If you do a lot of systems, a long time did not use if else, so that you may enter the real position of the OO design. (This is my own invention of the actual combat evaluation of the measurement standard).
Posted on 2006-09-16 18:45 Xu Haidong Reading (88) Comments (0) edit their collections quoted Category: J2EE learning
Newspapers three modes of cell phone who NO.1
With the maturity of the electronic network technology, modern minute later never become increasingly mobile world wide application of electronic reading displays, and may gradually become people's future access to news and information of a major reading terminals. Using a mobile phone to watch television, read newspapers, to novels, listening to music and…… All this signals that the phones as a new medium of the media, in communications, began to disseminate information, and cultural and recreational new features. Along with the rapid development of wireless Internet, 3 G application and the growing popularity of mobile phones, traditional print media especially newspapers and mobile terminals and wireless technologies, "intimate contact" More and more, in the face of the impact of networks, newspapers and mobile media operators who provide a new opportunity. Worldwide, the mobile phone-based news media even as a newspaper rejuvenation of the hope that it can help newspaper readers and advertisers with a more stable relationship to provide a new source of profits and more effective means of communication.
Dissemination of news and information phone What are the main way? Judging from the current situation, using a mobile phone as a terminal to read the following three main forms:
1. SMS messages in the first type is just mobile operators to address the high cost of mobile phone calls launched by the issue of cheap text messaging services. Along with technological development, SMS from simple text format development can be illustrated as MMS. Therefore, the SMS mobile phone newspaper is the most basic wireless platform. Newspapers use SMS phones, cell phone users can customize messages, and messages to obtain information on demand. Compared to traditional media, with newspapers SMS mobile phone reception simple and quick, more targeted benefits. But because of technical limitations, SMS still unable to reach traditional media information breadth, depth and diversity of the same expenses, through SMS access to the information capacity is far less than the newspaper, not to talk about outside of broadcasting text messages TV and the network information.
At the national level, major Internet portals in access to value-added business license, have introduced mobile phone SMS version of the newspaper, could be limited to the quality of content, users repercussions general. The newspaper is not far behind, "Yangzi Evening" opened in 2001 to channel messages to users send text messages News. Ever since then, many newspapers to adopt various forms to launch its own mobile phone newspapers, and strive to make our own newspaper coverage of the broader mobile phone.
2.WAP-WAP is a global network of communication protocols through WAP platform on the internet information and the introduction of business to mobile phones and other wireless terminals, the current HTML language online information into WHL described by the message that in the mobile phone displays. The so-called wireless value-added business, including the cell phone text message to order and ring tones, MMS downloads and mobile phone networks in the WAP games are achieved. With a WAP-enabled cell phones have become mass consumer goods, more and more users access the Internet via mobile phones of various information.
With the WAP technology continues to mature, and mobile operators to promote the major newspapers have launched its own WAP phones reported that the traditional platform for wireless access to the media, newspapers, and the WAP version of the co-promoting dynamic, complement each other. One of the most impressive people this year is the province of Guangdong Mobile's nine three newspaper groups launched a joint mobile phone WAP version of the newspaper.
Compared to type SMS, WAP-based content more rich, basically-can be called by mobile phone newspapers. However, due to technical constraints WAP, WAP-based mobile phone content was simple, size-fits-style, it is difficult to reflect the personality differences between newspapers. Over time, users gleaning seeks unconventional psychological not met, the development of mobile phone newspaper also stalled. In addition, the WAP-based mobile phone user-oriented newspapers only simple, single business model, the lack of forward momentum.
3. Palm letter is a letter of palm green cell phone software, users can download and install on their own, can also advance by mobile phone manufacturers installed. This way, when mobile phone users and manufacturers have made a link between the bridge. Metacarpal letter also published the full text of the functions of mobile phones newspapers, and also in accordance with the newspaper's own style characteristics of the layout was modified cell phones, take a variety of forms to transmit the information. In the business model, palm letter phones are based on the characteristics of various devices separate development, and ensured the "interactive advertising," "streaming media" and other special features can be achieved.
At present, palm-point letter has been in various handheld handheld terminals (cell phones, smart phones and handheld computers, etc.) to achieve the dynamic download and players here. Accumulation company has more than 20 well-known domestic and media cooperation, not only broke the geographical restrictions of media releases, and ensures a powerful source of information and content quality. Poly point palm letter recently launched Beijing, Shanghai, Guangzhou, Nanjing, and other big cities living information services, will allow users to surf the fingertip the streets of major cities. More importantly, the introduction of life information, businessmen, newspaper publishers and mobile phone users linked, and the profitability of the newspaper on phone model, did a beneficial exploration.
Digital Converters category
Import java.io. *;
Class ConvertNum
(
Boolean bool = false;
Int group;
Int length;
Int left;
String convertResult;
Public void setData (String s)
(
Length = s.length ();
For (int i = 0; i
If (! Bool & s.charAt (i) == '.')
(
Left = i;
If (i> 12)
Return;
Bool = true;
If (i% 4> 0)
Group = i / 4 +1;
Else
Group = i / 4;
)
)
If (! Bool)
(
Left = length;
If (length% 4> 0)
Group = (length) / 4 +1;
Else
Group = (length) / 4;
)
SplitStr (s);
)
Public void splitStr (String s)
(
String leftStr [] = new String [group];
String right = "";
String temp = "";
For (int i = 1; i <= group; i + +)
(
If (left <4)
(
LeftStr s.substring [0] = (0, left);
)
Else
(
If (i
Else
LeftStr [group-i] = s.substring (0, left-4 * (i-1));
)
)
If (bool)
(
If (length-left <= 3)
(
= S.substring right (left +1, length). Trim ();
If (right.length () <1)
(
Bool = false;
System.out.println ( "you input data by integer calculation!");
)
If (right.length () == 1)
Temp = convertChar (right.charAt (0)) + "zero angle";
If (right.length () == 2)
Temp = convertChar (right.charAt (0)) + "corner" + convertChar (right.charAt (1)) + "points";
)
Else
(
= S.substring right (left +1, left +4). Trim ();
Temp = convertChar (right.charAt (0)) + "corner" + convertChar (right.charAt (1)) + "points";
)
/ / Integer
If (! Bool)
(
ConvertResult = convert (leftStr) + "whole";
System.out.println (convertResult);
)
/ / Decimal
Else
(
System.out.println (the "retained two decimal system, you enter is:");
ConvertResult = convert (leftStr) + temp;
System.out.println (convertResult);
)
)
Public String convert (String s [])
(
String returnStr = "";
For (int i = 0; i <group; i + +)
(
If ((group-i) == 3)
(
ReturnStr + = returnStr convertSub (s [i]) + "billion";
System.out.println ( "million");
)
If ((group-i) == 2)
(
If (convertSub (s [i]). Equals ("")){}
+ = ReturnStr else returnStr convertSub (s [i]) + "10000";
System.out.println ( "10000");
)
If ((group-i) == 1)
(
ReturnStr + = returnStr convertSub (s [i]) + "dollars";
System.out.println ( "dollars");
)
)
Return returnStr;
)
Public String convertSub (String s)
(
String returnStr = "";
String tempStr [] = new String [s.length ()];
Int bl = s.length ();
If (Integer.valueOf (s). IntValue ()% 10 == 0)
Bl = s.length () -1;
For (int j = 0; j
If (1 == group left == 1 & & & & s.charAt (0) =='0 ')
Return "zero";
Int k = 4-s.length () + j;
Switch (k)
(
Case 0:
If (s.charAt (j) =='0 ') tempStr convertChar [j] = (s.charAt (j));
Else tempStr convertChar [j] = (s.charAt (j)) + "46";
Break;
Case 1:
If (s.charAt (j) =='0 ') tempStr convertChar [j] = (s.charAt (j));
Else tempStr convertChar [j] = (s.charAt (j)) + "632";
Break;
Case 2:
If (s.charAt (j) =='0 ') tempStr convertChar [j] = (s.charAt (j));
Else tempStr convertChar [j] = (s.charAt (j)) + "Plum";
Break;
Case 3:
If (s.charAt (j) =='0 ')
Break;
TempStr convertChar [j] = (s.charAt (j));
Break;
)
)
For (int j = 0; j
If (s.length () == 2 & & Integer.valueOf (s). IntValue ()% 10 == 0)
Return tempStr [0];
If ((s.charAt (j) =='0 '& & s.charAt (j +1) =='0'))
(
J + +;
If (Integer.valueOf (s). IntValue (%) 1000 == 0)
Return returnStr;
If (Integer.valueOf (s). IntValue ()% 100 == 0)
Return returnStr;
If (s.charAt (j +1) =='0 ')
(
J + +;
ReturnStr + = returnStr tempStr [j]. ToString ();
)
+ = ReturnStr else returnStr tempStr [j]. ToString ();
)
+ = ReturnStr else returnStr tempStr [j]. ToString ();
)
Return returnStr;
)
Public String convertChar (char i)
(
String s = "";
Switch (i)
(
Case'0 ':
S = "zero";
Break;
Case'1 ':
S = "one";
Break;
Case'2 ':
S = "2 for";
Break;
Case'3 ':
S = "three";
Break;
Case'4 ':
S = "widespread";
Break;
Case'5 ':
S = "Mrs.";
Break;
Case'6 ':
S = "land";
Break;
Case'7 ':
S = "qi";
Break;
Case'8 ':
S = "Ba";
Break;
Case'9 ':
S = "jiu";
Break;
)
Return s;
)
Public static void main (String [] args)
(
System.out.println ("******************************************* ******************" +
"\ N" + "Welcome to the digital conversion system" +
"\ N" +
"\ N" + "scope :99999999999.99-0.00" +
"\ N" +
"\ N" + "copyright: the Ma family" +
"\ N *********************************************** **************");
New ConvertNum (). SetData ( "103056009010.13");
)
)
Father of Java criticism Java open-source Java projects will go astray
The open-source Apache recently launched Harmony J2SE project, "the father of Java," said James Gosling opposing views.
Harmony is the Apache open-source organization recently launched a project aimed at providing open-source J2SE 5.0. James Gosling that most users will not choose an open-source Java Implementation. Gosling said: "Sun's Java development above has invested in more than 1,000 individuals, and if the Java into an open-source product will deviate from the right path it."
See the full text: http://www.devx.com/Java/Article/28125?trk=DXRSS_LATEST
keep looking »