Java listener ehcache 2.2.0 released

Source: Internet
Author: User

 

Each language has its own callback method, and Java is no exception.
Java callback uses a multi-state method to call back and forth. For example:

 

Interface mouselistener {// when the click method is called, it indicates that the mouse has clicked. Void click ();}

The above is an interface with only one method in it. First, we will use an example to show that Java is used to display the power of polymorphism.

 

 

Public class model {// initialize 50 listeners private mouselistener [] listeners = new mouselistener [50]; // used to record where the current listeners Array records int Index = 0; public void addlistener (mouselistener listener) {// register a listener listeners [index ++] = listener to this model;} public void clickmodel () {// call the click Method for registering all listener for (INT I = 0; I <index; I ++) {listeners [I]. click () ;}/// test model public static void main (string [] ARGs) {model = new model (); // Add an anonymous internal class, the click method is implemented. model. addlistener (New mouselistener () {public void click () {system. out. println ("I was clicked") ;}}); // Add another internal class. model. addlistener (New mouselistener () {public void click () {system. out. println ("I was clicked") ;}}); // click model below. clickmodel ();}}

Ii. java. Lang. outofmemoryerror: Java heap Space
Solution in myeclipse:
Myeclipse-> preferences-> myeclipse-> servers-> tomcat-> Tomcat ×. ×-> In the JDK panel
Added in optional Java VM arguments
-Xmx512m-xms256m-XX: maxpermsize = 256 m

 

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.