Vous êtes sur la page 1sur 2

*************************************************************************************************** Abstract class vs Interface

An interface is used to define a set of methods that a class can choose to implement An abstract class is similar but can include " (i) data fields that can then be shared by subclasses " " (ii) implementations of some methods that serve as default behavior when not overridden in " " " " *************************************************************************************************** Information Hiding

Information Hiding - language feature of capability that allows certain aspects of the software from being inacces - one way to achieve this is to provide a interface, which does not change " " " -- though the underlying implementation can change, but this does not affect the users " - hides design decisions that are likely to change " "

*************************************************************************************************** Encapsulation " " " " " " " "

way of organizing data and methods into a structure and concealing the way it is implemented provides the ability to validate/process the values in a method before they are applied to th -- preserves integrity of the data encapsulation defines access levels: public, protected, private data does NOT have to be hidden " -- difference from Information Hiding

*************************************************************************************************** Abstraction

Abstraction means hiding the complexity of a system and providing a simple interface for it

*************************************************************************************************** Polymorphism " " " " " "

- Dynamic binding: JVM decides at run-time which method to invoke, depending on the type of the

- Polymorphism means you can use a variable of a superclass type to hold a reference to an obje " - the type of the object should be the same as the superclass or any of the superclass su - Why are these two useful? Old code will work even when new subclasses are created." " " -- If Orange is a subclass of Fruit, then dynamic binding ensures that its methods are " " -- Code for orange need not have been written when Fruit was written and compiled

***************************************************************************************************

try { } finally { ...}. . Finally creates a block of code that will be executed after the try/cat So, if a database connection was opened in the try block (and closed towards the end of it), but an

Final: prevent programmers from creating subclasses, or overriding certain methods. String class i A security class can have the method that checks the password as a final method so that one canno

*************************************************************************************************** Advantages of Maven :

quick project setup, no complicated build.xml files, just a POM and go all developers in a project use the same jar dependencies due to centralized POM. getting a number of reports and metrics for a project "for free" reduce the size of source distributions, because jars can be pulled from a central location

*************************************************************************************************** Volatile :

The volatile keyword is used on variables that may be modified simultaneously by other threads. Ens Compiler does not cache these variables in registers. Inhibits certain optimizations that assume no other thread will change the values unexpectedly. Sin

*************************************************************************************************** HashMap and Hashtable do not guarantee that the order of the map will remain constant over time. (T Hashtable is synchronized, HashMap is not. Vector is synchronized, arraylist is not.

*************************************************************************************************** LinkedList vs. ArrayList ArrayList

The ArrayList is actually encapsulating an actualy Array, an Object[]. When you instanciate ArrayLi This gives you strengths and weaknesses:

Fast Random Access You can perform random access without fearing for performence. Calling get(int) will just access th

Adding values might be slow When you dont know the amount of values the array will contain when yo Slow manipulation When youll want to add a value randomly inside the array, between two already ex

LinkedList

The LinkedList is implemented using nodes linked to each other. Each node contains a previous node When new data is inserted, a node is inserted and the links of the surrounding nodes are updated ac When one is removed, the same happens The surrounding nodes are changing their links and the dele

Fast manipulation As youd expect, adding and removing new data anywhere in the list is instantanio

No random access Even though the get(int) is still there, it now just iterates the list until it re It has some optimizations in order to do that, but thats basically it.

*************************************************************************************************** Reflections: http://tutorials.jenkov.com/java-reflection/index.html

Java's Reflection API's makes it possible to inspect classes, interfaces, fields and methods at run

***************************************************************************************************

Vous aimerez peut-être aussi