tag:blogger.com,1999:blog-88230981342945625422024-02-20T12:33:13.065-08:00Understanding Java Technologiesjavagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.comBlogger48125tag:blogger.com,1999:blog-8823098134294562542.post-50488312187892858432011-10-17T05:51:00.001-07:002011-10-17T05:51:10.461-07:00What is Java inheritence and compositionComposition vs. Inheritance in Java.<br />
<br />
When Introduced to Object Orientation I was very excited about inheritance and class hierarchies and what I could do with them. Over time, I've come to focus more on interfaces and (in general) use composition rather than inheritance.<br />
<br />
Inheritance in java is super easy. If we want to build, for instance, a case-insensitive HashMap how would we do it? (I chose HashMap because it shows the good, the bad, and the ugly of each approach, while remaining trivial). With Inheritance it's pretty easy. We simply extend HashMap and override the methods dealing with keys:<br />
<br />
import java.util.HashMap;<br />
<br />
public class NoCaseHashMap extends HashMap {<br />
<br />
private String toKey(Object key) {<br />
if (key == null) {<br />
return null;<br />
}<br />
return key.toString().toLowerCase();<br />
}<br />
<br />
public Object get(Object key) {<br />
return super.get(toKey(key));<br />
}<br />
<br />
public Object put(Object key, Object value) {<br />
return super.put(toKey(key), value);<br />
}<br />
<br />
public boolean containsKey(Object key) {<br />
return super.containsKey(toKey(key));<br />
}<br />
<br />
public Object remove(Object key) {<br />
return super.remove(toKey(key));<br />
}<br />
<br />
}<br />
<br />
Ta-da! Done.<br />
<br />
But, the first downside to this approach is that, in Java, we may only inherit implementation (extend) from one superclass. There are times when that seems constrictive. In this simple case that is no big deal.<br />
<br />
The less obvious downside of Inheritance is that we've locked this into a particular Map implementation. What happens when we want a LinkedHashMap or a WeakHashMap or even a TreeMap? Early binding to a particular implementation is Inheritance's biggest shortcoming.<br />
<br />
Enter Composition.<br />
<br />
With Composition we can late bind to the implementation. Rather than extend HashMap, we could, for instance, take a Map object as a construction parameter and leave the implementation choice open.<br />
<br />
The first obvious down-side to Composition is that it is not as light-weight in Java. Every method must be added, not just the ones that change.<br />
<br />
The second, less obvious, downside is that with inheritance super classes can call the methods of the sub-class, but this is not so with composition.<br />
<br />
import java.util.Collection;<br />
import java.util.Iterator;<br />
import java.util.Map;<br />
import java.util.Set;<br />
<br />
public class NoCaseMap implements Map {<br />
<br />
private Map map;<br />
<br />
public NoCaseMap(Map map) {<br />
this.map = map;<br />
}<br />
<br />
private String toKey(Object key) {<br />
if (key == null) {<br />
return null;<br />
}<br />
return key.toString().toLowerCase();<br />
}<br />
<br />
public Object get(Object key) {<br />
return map.get(toKey(key));<br />
}<br />
<br />
public Object put(Object key, Object value) {<br />
return map.put(toKey(key), value);<br />
}<br />
<br />
public boolean containsKey(Object key) {<br />
return map.containsKey(toKey(key));<br />
}<br />
<br />
public Object remove(Object key) {<br />
return map.remove(toKey(key));<br />
}<br />
<br />
/* Note the need to implement putAll(map) with composition */<br />
public void putAll(Map t) {<br />
for (Iterator it = t.entrySet().iterator(); it.hasNext();) {<br />
Map.Entry entry = (Map.Entry) it.next();<br />
put(entry.getKey(), entry.getValue());<br />
}<br />
}<br />
<br />
// --------------------------------------<br />
// The rest of these are just the standard cruft of composition:<br />
// --------------------------------------<br />
public void clear() {<br />
map.clear();<br />
}<br />
<br />
public boolean containsValue(Object value) {<br />
return map.containsValue(value);<br />
}<br />
<br />
public Set entrySet() {<br />
return map.entrySet();<br />
}<br />
<br />
public boolean isEmpty() {<br />
return map.isEmpty();<br />
}<br />
<br />
public Set keySet() {<br />
return map.keySet();<br />
}<br />
<br />
public int size() {<br />
return map.size();<br />
}<br />
<br />
public Collection values() {<br />
return map.values();<br />
}<br />
}<br />
<br />
More code (even if it was auto-generated) obviously, but also plug-able and flexible.<br />
When to use Inheritance and when to use Composition?<br />
<br />
Traditionally, we are told to use inhertance when one class has an "is a" relationship with another, and composition when one class has a "has a" relationship with another. While I do not dispute this in the slightest, I will warn that this is trickier than it sounds. We've pobably all seen the bad textbook example of something like "Programmer" and "Manager" as extending "Employee" ... well, maybe ... but perhaps it is more useful to think of "Programmer" as a set of duties that an "Employee" may have, and this same employee may later change duties for "Manager" duties. Often "is a" and "has a" relationships are more arbitrary than they might first appear. If "is a" and "has a" relationsips are just a matter of perspective, what should we do?<br />
<br />
As a rule of thumb:<br />
<br />
* Use composition (not inheritance) to get code re-use and/or polymorphism. as Bill Venners suggests (JavaWorld.com, 11/01/98)<br />
* Use inheritance when super-classes must significantly interact with their sub-classes. (But consider Strategy pattern instead.)<br />
* Use inheritance when we are forced to.<br />
<br />
If the "parent" must call back to "child" methods, then Inheritance is usually the only good answer. However, in general, the late-binding aspect of Composition tends to be better, even with the added irritation of the the pass-through methods. What are the relationships between the classes? Is one the abstract "brains" and the other provided a strategy for some internal functionality? Or is one a "Decorator" of another where composition is obvious? Like:<br />
<br />
new BASE64EncoderStream(new BufferedOutputStream(new FileOutputStream(file)))<br />
<br />
I used to see problems mostly in terms of super and sub-classes. These days most problems look better solved with composition. And if it weren't for the heavier weight of composition, I'd probably use it nearly exclusively, except for when inheritance was the really obvious winner.<br />
<br />
If intermediate classes get introduced into the heirarchy that are hard to name, it may be a good idea to consider composition; if the names don't make a lot of sense, that's probably a hint that we should be thinking harder about our design, anyway. Usually I see this happening as we try to push common code into some super-class, but that superclass doesn't actually represent any particular general concept.<br />
<br />
There are also times when we are forced to use inheritance becuase some method expects a concrete class as a parameter, not an interface. The core java language is full of examples where implementations are expected which could be interfaces: java.io.Writer and java.io.File jump to mind.<br />
<br />
When I see that I am forcing extenders to use inheritance, I take this as a sign that I should think hard about the architecture; in general it has turned out to be symptom of inferior design. As a rule of thumb, I try to design for interfaces and plug-ability, not sub-classing.<br />
<br />
There are many ways of re-thinking towards plugability. Sometimes it is just a matter of using interfaces and having a default implementation. Sometimes it is a matter of thinking about the problem from the other direction: for instance, rather than having an abstract super-class which expects a concrete sub-class to implement a function or two, we can create a concrete class which expects a collaborator object to implement those functions (the "Strategy" pattern ). With understanding of just the "Strategy" and "Decorator" patterns it becomes possible to imagine completely designing for plugability without using inheritance at all.<br />
<br />
When in doubt, I try to let testing be my guide, because testing tends to be the first place where I find myself wanting plug-ability. For instance, if a "base class" requires a lot of set-up and tear-down to instantiate and test, and a "sub-class" is adding something which doesn't directly interact with the elements that require set-up and tear-down, this may be a hint that we could restructure to use composition and test the add-on behavior in isolation more easily.javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com1tag:blogger.com,1999:blog-8823098134294562542.post-90549758681151554332011-10-16T04:27:00.000-07:002011-10-16T04:27:39.326-07:00What is Store Procedure?Stored routines (procedures and functions) are supported in any SQL programming. A stored routine is a set of SQL statements that can be stored in the server. Once this has been done, clients don't need to keep reissuing the individual statements but can refer to the stored routine instead.<br />
<br />
Stored routines require the proc table in the sql database. This table is created using procedure. I<br />
Stored routines can be particularly useful in certain situations:<br />
<br />
* When multiple client applications are written in different languages or work on different platforms, but need to perform the same database operations.<br />
* When security is paramount. Banks, for example, use stored procedures and functions for all common operations. This provides a consistent and secure environment, and routines can ensure that each operation is properly logged. In such a setup, applications and users would have no access to the database tables directly, but can only execute specific stored routines.<br />
<br />
Stored routines can provide improved performance because less information needs to be sent between the server and the client. The tradeoff is that this does increase the load on the database server because more of the work is done on the server side and less is done on the client (application) side. Consider this if many client machines (such as Web servers) are serviced by only one or a few database servers.<br />
<br />
Stored routines also enable you to have libraries of functions in the database server. This is a feature shared by modern application languages that enable such design internally (for example, by using classes). Using these client application language features is beneficial for the programmer even outside the scope of database use.<br />
<br />
The SQL implementation of stored routines is still in progress. All syntax described here is supported and any limitations and extensions are documented where appropriate.javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com0tag:blogger.com,1999:blog-8823098134294562542.post-10282007691577031382011-03-19T23:16:00.000-07:002011-03-19T23:16:27.282-07:00Java save our EarthSave our earth by visiting here<br />
<br />
<a href="http://says.my/lovhana/livegreen-wwf2">http://says.my/lovhana/livegreen-wwf2</a><br />
<br />
<a href="http://says.my/lovhana/groupsmore-invite">http://says.my/lovhana/groupsmore-invite</a><br />
<br />
<a href="http://says.my/lovhana/wwfkl">http://says.my/lovhana/wwfkl</a>javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com0tag:blogger.com,1999:blog-8823098134294562542.post-19314901815932565322011-03-12T21:31:00.001-08:002011-03-12T21:31:35.808-08:00java certification trainingAs someone seeking work in the IT and software industry, there is much hype and pressure to learn and become expert in the <a class="kLink" href="http://goarticles.com/article/What-You-Must-Know-About-Sun-Java-Certification-Before-Passing-The-Exam/910477/#" id="KonaLink0" style="font-family: inherit ! important; font-size: inherit ! important; font-weight: inherit ! important; position: static; text-decoration: underline ! important;"><span style="color: blue ! important; font-family: inherit ! important; font-size: inherit ! important; font-weight: inherit ! important; position: static;"><span class="kLink" style="color: blue ! important; font-family: inherit ! important; font-size: inherit ! important; font-weight: inherit ! important; position: relative;">java</span></span></a> language. In the software industry, there is no actual programming license which means that virtually anyone can pick up a few books or tutorials and claim to be proficient. In light of this, to protect prospective employers, the industry recognizes certification, which shows that someone has been willing to undertake additional training and pass arduous and exacting examinations. Sun Microsystems has become established as a leader in IT <a class="kLink" href="http://goarticles.com/article/What-You-Must-Know-About-Sun-Java-Certification-Before-Passing-The-Exam/910477/#" id="KonaLink1" style="font-family: inherit ! important; font-size: inherit ! important; font-weight: inherit ! important; position: static; text-decoration: underline ! important;"><span style="color: blue ! important; font-family: inherit ! important; font-size: inherit ! important; font-weight: inherit ! important; position: static;"><span class="kLink" style="color: blue ! important; font-family: inherit ! important; font-size: inherit ! important; font-weight: inherit ! important; position: relative;">technology</span></span></a> training and outlined a number of paths to certification in java, depending on your objectives. This article seeks to shed light on the sun java certification process by outlining what can be expected when preparing for the exams and some food for thought on what <a class="kLink" href="http://goarticles.com/article/What-You-Must-Know-About-Sun-Java-Certification-Before-Passing-The-Exam/910477/#" id="KonaLink2" style="font-family: inherit ! important; font-size: inherit ! important; font-weight: inherit ! important; position: static; text-decoration: underline ! important;"><span style="color: blue ! important; font-family: inherit ! important; font-size: inherit ! important; font-weight: inherit ! important; position: static;"><span class="kLink" style="color: blue ! important; font-family: inherit ! important; font-size: inherit ! important; font-weight: inherit ! important; position: relative;">certification</span></span></a> actually means.<br />
Sitting for the Sun Certified exams is no walk in the park. It is strongly advised that a course of preparation is embarked on before attempting an exam. The java language is still fairly new and thus the need to distinguish oneself from a beginner. The Sun Java Certified programmer is approriate for existing commercial programmers with post secondary education and a minimum of 6 months experience in java. As the pool of professionals with this certification is still relatively low, many attribute attaining certification with heightening employment opportunity and renumeration. <br />
There is a small fee involved with taking each of the exams, which is non refundabe. This provides further incentive for studying. The exam itself is multiple choice which may prove to be deceptive in indicating the ease of success. The questions sometimes require the selection of all the applicable responses and none of the incorrect ones. There are often small nuances that must be recognized and you need a thorough understanding of the language to choose correctly. Sun Microsystems provides training in all pathways from programmer, to the more advanced developer and java architect. There are numerous books, course, and online and offline study guides available with practice exams for preparation. There is no doubt that those who practice the language daily and take the opportunity to use a study guide or course along with a background in using the language, will have a much easier and less stressful time passing the exam the first time around. Bear in mind, you can take the exam an unlimited number of times in order to pass.<br />
Once you have successfully become certified as a programmer, you can choose to go on and take the Sun Certified Java Developer. Here the range of topics covered in the exam is wider and you must demonstrate mastery at a more complex level. Before taking the exam, it is necessary to successfully complete a practical assignment where you are given a set of programming requirements and must create a system using them. This component demonstrates a higher level of understanding and <a class="kLink" href="http://goarticles.com/article/What-You-Must-Know-About-Sun-Java-Certification-Before-Passing-The-Exam/910477/#" id="KonaLink3" style="font-family: inherit ! important; font-size: inherit ! important; font-weight: inherit ! important; position: static; text-decoration: underline ! important;"><span style="color: blue ! important; font-family: inherit ! important; font-size: inherit ! important; font-weight: inherit ! important; position: static;"><span class="kLink" style="color: blue ! important; font-family: inherit ! important; font-size: inherit ! important; font-weight: inherit ! important; position: relative;">application</span></span></a> of the java language. <br />
It is widely acknowledged that attaining sun <a class="kLink" href="http://goarticles.com/article/What-You-Must-Know-About-Sun-Java-Certification-Before-Passing-The-Exam/910477/#" id="KonaLink4" style="font-family: inherit ! important; font-size: inherit ! important; font-weight: inherit ! important; position: static; text-decoration: underline ! important;"><span style="color: blue ! important; font-family: inherit ! important; font-size: inherit ! important; font-weight: inherit ! important; position: static;"><span class="kLink" style="color: blue ! important; font-family: inherit ! important; font-size: inherit ! important; font-weight: inherit ! important; position: relative;">java </span><span class="kLink" style="color: blue ! important; font-family: inherit ! important; font-size: inherit ! important; font-weight: inherit ! important; position: relative;">certification</span></span></a> shows a high level of competency. Yet, there are those that are justifiably critical of the certification process in general and Sun Java Certification in particular. Some believe the certification process is more useful as a diagnostic tool than a measure of aptitude or potential. The Sun Java programmer exam, for example, by emphasizing syntax may leave one open to gaps in knowledge and understanding. Some believe the tests are still too straightforward and do not encourage ongoing professional development. There is simply too much emphasis on doing what it takes to pass rather than focusing on how one can consistently attain new levels of education. Community managed certification tracks such as Java Blackbelt may provide an alternative long term view to professional development.<br />
Whether you choose to use Sun Microsystem's path to java certification or go with some other third party, it is a major decision and undertaking. Doing so will go a long way to showing your dedication to becoming highly skilled and competent. The Java domain is still seen as difficult and thus certification is a significant credential and an industry measure of technical excellence. Your persistence, dedication and professionalism will determine how far this takes you.javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com1tag:blogger.com,1999:blog-8823098134294562542.post-66204530437769288942011-03-12T21:25:00.000-08:002011-03-12T21:25:14.431-08:00what is java software<a href="http://java2k11.blogspot.com/"><b>what is java</b> software</a>javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com0tag:blogger.com,1999:blog-8823098134294562542.post-76618162952297901162011-03-12T21:23:00.000-08:002011-03-12T21:23:28.524-08:00java applets<a href="http://java2k11.blogspot.com/">java applets</a>javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com0tag:blogger.com,1999:blog-8823098134294562542.post-33467526336750798802011-03-12T21:22:00.000-08:002011-03-12T21:22:05.986-08:00java programming course<a href="http://java2k11.blogspot.com/">java programming course</a>javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com0tag:blogger.com,1999:blog-8823098134294562542.post-11957484130900166582011-03-12T21:20:00.000-08:002011-03-12T21:20:32.297-08:00Java Courses<a href="http://java2k11.blogspot.com/">Java Courses</a>javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com1tag:blogger.com,1999:blog-8823098134294562542.post-64884453428829400302011-03-12T18:55:00.001-08:002011-03-12T18:55:52.226-08:00What is J2ME Apps DevJ2ME or also know as Java ME is a platform that is specifically designed for application development to run on mobile phones, PDAs and other embedded systems. <a href="http://www.aegisisc.com/j2eedevelopment.htm" rel="nofollow" target="_new">J2ME development</a> features an adaptable user interface, which integrates with network protocols and extends support for mobile application development. <br />
The mobile applications that are developed on J2ME can be also migrated across various different mobile devices. J2ME application developers create a variety of different mobile applications based on the customized requirements of the clients. They are experience in creating diverse mobile solutions and hence most clients prefer to outsource their mobile business applications to India. <br />
<b>J2ME Architecture and configuration</b> <br />
J2ME comprises of configurations and profiles that allow a developer to customize it for the Java Runtime Environment (JRE). The configuration defines the JVM used and the profile adds domain-specific classes to define the application. <br />
<b>Configurations</b>: The configuration uses a set of core classes and a specific JVM to define the basic run-time environment. The configurations are of two types where one is called CLDC for handled devices and the second one is CDC for plug-in devices. CLDC is has been developed for 16-bit or 32-bit small computing devices that have limited memory. CDC requires a 32-bit architecture and has at least 2 MB of memory and implements a functional JVM. <br />
<b>Profiles</b>: A profile comprises of classes that allow J2ME application developers to execute features that are typically available on a group of small computing devices. The profiles used with CLDC are mobile information device profile (MIDP) and PDA profile (PDAP). The profiles used with CDC include Foundation Profile, Game Profile, Personal Profile, Personal Basis Profile and RMI Profile. <br />
<b>J2ME Architecture</b> <br />
The J2ME architecture consists of five layers and they are as follows:<br />
<ul><li>MIDP: This is the topmost layer and consists of Java APIs. J2ME application developers use these APIs to create network connections, storage, and user interface. It also provides access to CLDC libraries and MIDP libraries.</li>
<li>J2ME API's: This is the profile that comprises of a minimum set of application programming interfaces required for the small computing devices.</li>
<li>Configurations: This is responsible to manage the interactions between the JVM and the profile.</li>
<li>JVM</li>
<li>Operating System: This is the bottom layer.</li>
</ul>javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com0tag:blogger.com,1999:blog-8823098134294562542.post-24396293120057358102011-03-11T17:25:00.000-08:002011-03-11T17:25:20.613-08:00What is java used forJava is a highly popular programming language and computer platform originally developed in 1995 by Sun Microsystems when the existing software, called OAK, was renamed. According to the Java website, 850million worldwide use Java and the software is claimed to be integral to a wide variety of computing functions including business intranet applications and other e-business software.<br />
<br />
Java runs on something called the Java Runtime Environment (JRE) which consists of the Java Virtual Machine (JVM), Java platform core classes and supporting Java libraries. The JRE enables you to run the software in your web browser.<br />
<br />
Originally Java was intended for the television industry but it became apparent that the software was too advanced for the cable technology of the time. Java incorporates a function called 'Write Once, Run Anywhere' which means that the code can be written on a PC but also used on a wide variety of other devices that use JVM such as Java-enabled cell phones, routers and mainframes. It does this by using something called Java Bytecode which can be interpreted by the JVM. The intention behind this is to eliminate the situation whereby a software developer has to rewrite the programming language to suit a different machine. Unfortunately, this hasn't worked as well as it was originally hoped since there can be many Java implementations alongside other operating systems such as Windows, Mac OS and Linux. This has led to some developers re-christening Java as 'Write once, debug everywhere'.<br />
<br />
In its early forms Java had a reputation for being rather slow in comparison to programs written in the usual C. However in 1998, Java 1.1 was released with Just-in-time compilation (JIT) also known as dynamic translation, the function of which is to speed up the execution of the bytecode. Java also uses an automatic garbage collector in order to manage memory automatically. This can activate at any time but is most likely to activate when a machine is idle.<br />
<br />
In 2006 Sun released Java as open-source software and versions of it can now be freely downloaded. The website claims that it's an essential piece of software on the basis that many websites and applications, including online gaming, won't run without it. I certainly remember the odd occasion when a piece of software has failed on me because I didn't have Java installed and so I have now installed a free version on my PC just before writing this. In addition, for those who want to use Java for programming, I would mention there are a load of tutorials available on the internet from the business software website Oracle. If you want to learn programming using Java it might therefore be worth your while downloading those as well.javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com0tag:blogger.com,1999:blog-8823098134294562542.post-86346514557782490432011-03-11T07:04:00.000-08:002011-03-11T07:04:37.196-08:00What is foreign keys in relational data base?Foreign key in what is java.<br />
<br />
What is foreign key in SQL?<br />
<br />
We use foreign key to match column in one table to primary key in column in another table either it is <br />
one to one relation or many to one.This foreign key can be used to cross reference table.<br />
<br />
Many database or data modelling will be in problem if relation of foreign key is not done properly.<br />
<br />
In one table , it can be many foreign keys and it is independently by the database system.Each key can have<br />
different reference tables.javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com0tag:blogger.com,1999:blog-8823098134294562542.post-27960937675020967652011-03-09T06:17:00.000-08:002011-03-09T06:23:58.033-08:00What is java Relational databasesWhat is java Relational databases<br />
<br />
What is database?<br />
We can store and retrieve information from place called database.<br />
<br />
What is java in relational database?<br />
Information that we present in tables as in row and column is called relational databases.<br />
Relational means that the collections of objects with the same type in one rows.<br />
We can relate data in table according to commons keys and retrieved data from table based on<br />
relations.<br />
<br />
What is Database Management Systems (DBMS)?<br />
DBMS is responsible to handle the way data is stored , maintained , and retrieved.<br />
<br />
<a href="http://blogskinny.com/?p=Vote&SID=6021"><img align="Left" alt="Blogging" border="0" id="Blogskinny_Img" name="Blogskinny_Img" src="http://blogskinny.com/Vote/?SID=6021" /></a>javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com0tag:blogger.com,1999:blog-8823098134294562542.post-29879880437668429522011-03-06T06:10:00.000-08:002011-03-06T06:23:24.636-08:00What is java<b>Today i will discuss what is java in synchronization and how it is implemented, and it is important?<br />
<br />
what is java in synchronization? <br />
<br />
The Java programming language provides two basic synchronization idioms: synchronized methods and synchronized statements.<br />
To make a method synchronized, simply add the synchronized keyword to its declaration:<br />
<br />
public class SynchronizedCounter <br />
{<br />
private int c = 0;<br />
public synchronized void increment()<br />
{<br />
c++;<br />
}<br />
public synchronized void decrement()<br />
{<br />
c--;<br />
}<br />
public synchronized int value()<br />
{<br />
return c;<br />
}<br />
}<br />
<br />
If count is an instance of SynchronizedCounter, then making these methods synchronized has two effects:<br />
<br />
* First, it is not possible for two invocations of synchronized methods on the same object to interleave. <b>When one thread is executing a synchronized method for an object, all other threads that invoke synchronized methods for the same object block </b>(suspend execution) <b>until the first thread is done with the object.</b><br />
* Second, when a synchronized method exits, it <b>automatically establishes a happens-before relationship</b> with any subsequent invocation of a synchronized method for the same object. This guarantees that changes to the state of the object are visible to all threads.</b><br />
<br />
<a href="http://blogskinny.com/?p=Vote&SID=6016"><img id="Blogskinny_Img" alt="Blogging" border="0" name="Blogskinny_Img" src="http://blogskinny.com/Vote/?SID=6016" align="Left" /></a>javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com0tag:blogger.com,1999:blog-8823098134294562542.post-37779523509994216942011-03-05T05:05:00.000-08:002011-03-05T05:05:08.440-08:00What is serialization in Java?When you serialize a Java object, you will be able to save its state as a sequence of bytes that will persist even after your Java virtual machine is not running. Next time, when you program is up and running again, it can rebuild the last state into its Java object form for reuse in your application. Usually, a serialized object can be stored on a hard disk as a file stream. Since it is a file stream, it can be transferred over a network as well.<br />
<br />
AXB uses the serialization approach to serialize a Java object into a XML form (marshal) and from a XML form to a Java object (unmarshal)<br />
<br />
But, get back to your actual question: why we need to serialize? Is it necessary?<br />
<br />
If you feel you need to persist your Java objects for short term purpose like a session and your interface definition stays the same across version revisions (that is an Animal object is still an Animal object despite an addition of new fields), use it.<br />
<br />
If you feel you need to persist your Java objects over a wire, use it.javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com0tag:blogger.com,1999:blog-8823098134294562542.post-82120750055738140132011-02-22T06:27:00.001-08:002011-02-22T06:31:52.042-08:00Ask Java 6<b><br />
<span style="color: #20124d;">Today i will cover simple and basic question if someone ask you what is java.</span><br style="color: #20124d;" /><span style="color: #20124d;">The first things you need to know regarding java is Object Oriented Programming or in </span><br style="color: #20124d;" /><span style="color: #20124d;">short OOP.So What is OOP?</span></b><b><br />
What is OOPs?<br />
<br />
<span style="color: #4c1130;">So your answer when people ask you this questions, what you will do is</span><br style="color: #4c1130;" /><span style="color: #4c1130;">you just rilex and explain to them OOP is programming whereby you </span><br style="color: #4c1130;" /><span style="color: #4c1130;">organizes your program in well defined interfaces to the data in object.Means</span><br style="color: #4c1130;" /><span style="color: #4c1130;">everything is in object.Nothing more.We can say object oriented as how we access</span><br style="color: #4c1130;" /><span style="color: #4c1130;">the data through object or in other word data controlling to code.</span></b><br />
<br />
<br />
<a href="http://blogskinny.com/?p=Vote&SID=5975"><img align="Left" alt="Blogging" border="0" id="Blogskinny_Img" name="Blogskinny_Img" src="http://blogskinny.com/Vote/?SID=5975" /></a>javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com0tag:blogger.com,1999:blog-8823098134294562542.post-14817825349650210672011-02-21T07:47:00.001-08:002011-02-21T07:55:38.303-08:00Ask Java 5<b>Topic for today we will cover simple basic question regarding access right.</b><b><br />
Lets say if main method we declared it as private?What will happen?<br />
<br style="color: #274e13;" /><span style="color: #274e13;">Explaination:</span><br style="color: #274e13;" /><span style="color: #274e13;">When main method is declared as private, it will shows you </span><br style="color: #274e13;" /><span style="color: #274e13;">message says "Main method not public" during runtime.Of course it will </span><br style="color: #274e13;" /><span style="color: #274e13;">compile properly.</span></b><br />
<br />
<a href="http://blogskinny.com/?p=Vote&SID=5964"><img align="Left" alt="Blogging" border="0" id="Blogskinny_Img" name="Blogskinny_Img" src="http://blogskinny.com/Vote/?SID=5964" /></a>javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com0tag:blogger.com,1999:blog-8823098134294562542.post-14002160816710282432011-02-20T01:50:00.000-08:002011-02-20T02:08:17.935-08:00Ask Java 4Today i will cover one more question here..simple yet basic<br />
<br />
<b>What is mutual exclusion? How can you take care of mutual exclusion using Java threads?</b><br />
<br />
<br />
<br />
<div style="color: #0b5394;"><b>Java provides many utilities to deal with mutual exclusion with the use of threaded programming.<br />
Mutual exclusion is where no two processes can access critical regions of memory at the same time.</b></div><div style="color: #0b5394;"><br />
</div><div style="color: #0b5394;"><b>For mutual exclusion, you can simply use the synchronized keyword and explicitly or implicitly provide an Object, any Object, to synchronize on.</b></div><b><br style="color: #0b5394;" /><span style="color: #0b5394;">The runtime system/Java compiler takes care of the gruesome details for you. The synchronized keyword can be applied to a class, to a method, or to a block of code. There are several methods in Java used for communicating mutually exclusive threads such as wait( ), notify( ), or notifyAll( ). For example, the notifyAll( ) method wakes up all threads that are in the wait list of an object. </span></b><br />
<br />
<a href="http://blogskinny.com/?p=Vote&SID=5960"><img align="Left" alt="Blogging" border="0" id="Blogskinny_Img" name="Blogskinny_Img" src="http://blogskinny.com/Vote/?SID=5960" /></a>javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com0tag:blogger.com,1999:blog-8823098134294562542.post-12478901131022569992011-02-19T06:11:00.000-08:002011-02-19T06:34:31.678-08:00Ask Java 3<b>What is a cartesian product in PL/SQL?</b><br />
<br />
<b style="color: #741b47;"> When a Join condition is not specified by the programmer or is invalid(fails), PL/SQL forms a Cartesian product.</b><br />
<div style="color: #741b47;"><b><br />
In a Cartesian product, all combinations of rows will be displayed.</b></div><b style="color: #741b47;"><br />
For example, All rows in the first table are joined to all rows in the second table. It joins a bunch of rows and it's result is rarely useful unless you have a need to combine all rows from all tables. </b><br />
<br />
<a href="http://blogskinny.com/?p=Vote&SID=5958"><img align="Left" alt="Blogging" border="0" id="Blogskinny_Img" name="Blogskinny_Img" src="http://blogskinny.com/Vote/?SID=5958" /></a>javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com0tag:blogger.com,1999:blog-8823098134294562542.post-34456586167465760462011-02-17T04:18:00.000-08:002011-02-17T04:18:29.253-08:00Difference between private, protected, and public?<div style="color: #4c1130;"><b>What is the difference between private, protected, and public?</b></div><br />
<b><span style="color: #134f5c;">These keywords are for allowing privilages to components such as functions and variables.</span></b><br />
<b><br style="color: #134f5c;" /><span style="color: #134f5c;">Public: accessible to </span></b><b style="color: #134f5c;">all </b><b><span style="color: #134f5c;">classes</span><br style="color: #134f5c;" /><span style="color: #134f5c;">Private: accessible </span></b><b style="color: #134f5c;">only to the class</b><b><span style="color: #134f5c;"> to which they belong</span><br style="color: #134f5c;" /><span style="color: #134f5c;">Protected: accessible to the </span></b><b style="color: #134f5c;">class</b><b><span style="color: #134f5c;"> to which they belong and any </span></b><b style="color: #134f5c;">subclasses. </b>javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com0tag:blogger.com,1999:blog-8823098134294562542.post-11835867117946484232011-02-16T03:06:00.000-08:002011-02-16T03:22:06.594-08:00Ask Java<b>What is a virtual function in C++?</b><br />
<br />
<b><span style="color: #351c75; font-family: Georgia,"Times New Roman",serif;">Simply put, the virtual keyword enables a function to be 'virtual' which then gives possibility for that function to be overridden (redefined) in one or more descendant classes. It is a good feature since the specific function to call is determined at run-time. In other words, a virtual function allows derived classes to replace the implementation provided by the base class.</span></b><br />
<br />
<b><span style="color: #351c75; font-family: Georgia,"Times New Roman",serif;">If u like this post clik this</span></b><br />
<b><span style="color: #351c75; font-family: Georgia,"Times New Roman",serif;"> </span></b><br />
<b><span style="color: #351c75; font-family: Georgia,"Times New Roman",serif;"> </span></b><br />
<br />
<a href="http://blogskinny.com/?p=Vote&SID=5947"><img align="Left" alt="Blogging" border="0" id="Blogskinny_Img" name="Blogskinny_Img" src="http://blogskinny.com/Vote/?SID=5947" /></a>javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com0tag:blogger.com,1999:blog-8823098134294562542.post-52911001947096263372011-02-15T06:28:00.000-08:002011-02-15T06:28:11.503-08:00Semantic Technology<div style="color: #741b47;"><b><u>Semantic Technology Part II</u></b> </div><div style="color: #741b47;"><br />
</div><div style="color: #741b47;"><b>Semantics contrasts with syntax, the study of the combinatorics of units of a language (without reference to their meaning), and pragmatics, the study of the relationships between the symbols of a language, their meaning, and the users of the language.<br />
<br />
The formal learning of semantics is therefore complex and complicated.Basically, the Semantic Web is only about two things. It is about common formats and pattern for integration and combination of data drawn from diverse sources, where on the original Web mainly concentrated on the interchange of documents. It is also<br />
about language for recording and captured the way data relates according to real world objects.<br />
</b></div><div style="color: #741b47;"><b>That allows a human, or a machine, to start off in one database, and then move through an unending set of databases which are connected not by wires but by being about the same thing or in others words nodes.<br />
<br />
The Semantic Web is the extension of the World Wide Web (WWW) that let the user to share content beyond the boundaries and limits of applications and websites. It has been explained in rather different ways: as a utopic vision, as a web of data, or merely as a natural paradigm shift in our daily use of the Web.<br />
<br />
All the time, the Semantic Web has inspired and engaged many people to create and invent innovative semantic technologies and applications. semanticweb.org is the common platform for this community.</b></div>javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com0tag:blogger.com,1999:blog-8823098134294562542.post-8800997381686758102011-02-15T06:14:00.000-08:002011-02-15T06:14:02.632-08:00Inversion of Control<b>Inversion of Control Part II </b><br />
<br />
<div style="color: #0b5394;"><b>Objects can be obtained by means of Dependency lookup or Dependency injection. Dependency lookup is a pattern where a caller asks the container object for an object with a specific name or of a specific type. Dependency injection is a pattern where the container passes objects by name to other objects, via either constructors, properties, or factory methods.</b></div><br />
<div style="color: #351c75;"><b>Most of the situation, it's not necessary to use the container when using other parts of the Spring Framework, although using it will likely make an application easier to configure and customize. The Spring container provides a consistent mechanism to configure applications and integrates with almost all Java environments, from small-scale applications to large enterprise applications.</b></div><br />
<b>The container can be changed into a partially-compliant EJB3 container by means of the Pitchfork project. The Spring Framework is criticized by some as not being standards compliant. However, SpringSource doesn't see EJB3 compliance as a major goal, and claims that the Spring Framework and the container allow for more powerful programming models.</b>javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com0tag:blogger.com,1999:blog-8823098134294562542.post-42629011471284114392011-01-30T01:17:00.000-08:002011-02-15T06:15:05.208-08:00Inversion of Control container (IoC)<b>Inversion of Control container Part I</b><br />
<br />
<div style="color: #0b5394;"><b>Central to the Spring Framework is its Inversion of Control container or ususally we called IoC , which supply a consistent ways of configuring and managing Java objects using callbacks. The container is responsible for managing object lifecycles: creating objects, calling initialization methods, and configuring objects by wiring them together.</b></div><b><br />
</b><br />
<div style="color: #351c75;"><b>Objects created by the container are also called Beans or Managed Objects . Usually, the container is configured by loading XML files containing Bean definitions which provide the information required to create the beans.</b></div>javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com0tag:blogger.com,1999:blog-8823098134294562542.post-11314074997092091992011-01-29T23:58:00.001-08:002011-02-15T06:19:49.267-08:00LISP Programming<div style="color: #134f5c;"><b>Lisp (or LISP) is a family of computer programming languages with a long history and a distinctive, fully parenthesized syntax. Originally specified in 1958, Lisp is the second-oldest high-level programming language in widespread use today; only Fortran is older (by one year). Like Fortran, Lisp has changed a great deal since its early days, and a number of dialects have existed over its history. Today, the most widely known general-purpose Lisp dialects are Common Lisp and Scheme.</b></div><b><br />
</b><br />
<div style="color: #0b5394;"><b>Lisp was originally created as a practical mathematical notation for computer programs, influenced by the notation of Alonzo Church's lambda calculus. It quickly became the favored programming language for artificial intelligence (AI) research. As one of the earliest programming languages, Lisp pioneered many ideas in computer science, including tree data structures, automatic storage management, dynamic typing, and the self-hosting compiler.</b></div><b><br />
</b><br />
<div style="color: #351c75;"><b>The name LISP derives from "LISt Processing". Linked lists are one of Lisp languages' major data structures, and Lisp source code is itself made up of lists. As a result, Lisp programs can manipulate source code as a data structure, giving rise to the macro systems that allow programmers to create new syntax or even new domain-specific languages embedded in Lisp.</b></div><b><br />
</b><br />
<div style="color: #741b47;"><b>The interchangeability of code and data also gives Lisp its instantly recognizable syntax. All program code is written as s-expressions, or parenthesized lists. A function call or syntactic form is written as a list with the function or operator's name first, and the arguments following; for instance, a function f that takes three arguments might be called using (f arg1 arg2 arg3).</b></div><b><br />
</b><br />
<b>Source from <a href="http://en.wikipedia.org/wiki/Lisp_%28programming_language%29">http://en.wikipedia.org/wiki/Lisp_(programming_language)</a></b>javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com0tag:blogger.com,1999:blog-8823098134294562542.post-68922552600297433752011-01-28T18:47:00.001-08:002011-02-15T06:26:45.202-08:00Semantics Tecnology<u><b>Semantics Tecnology Part I</b></u> <br />
<br />
<div style="color: #38761d;"><b>Semantics is the study of meaning. It basically focuses on the relation between signifiers, such as words, phrases, signs and symbols, and what they refer to , their denotata.Semantics is the research of meaning that is used by humans to express themselves through language. Other types of semantics include the semantics of programming languages, formal logics, and semiotics.</b></div><div style="color: #38761d;"><b><br />
</b></div><div style="color: #38761d;"><b>The term "semantics" itself reflects a range of ideas, from the popular to the highly technical. It is always used in ordinary language to denote a problem/issues of understanding that comes down to word selection or connotation.This issues of understanding has been the subject or ideas of many formal inquiries,over a long period of time, most notably in the field of formal semantics.</b></div><div style="color: #38761d;"><b><br />
</b></div><div style="color: #38761d;"><b>In linguistics, it is the study of interpretation of signs or symbols as used by agents or communities within specific circumstances and contexts.Within this view, sounds, facial expressions, body language,proxemics have semantic (meaningful) content or informations, and each has many branches of study. In written , such things as paragraph structure and punctuation have semantic content; in other forms of language, there is</b></div><div style="color: #38761d;"><b>other semantic content.</b></div><div style="color: #38761d;"><br />
</div><div style="color: #38761d;"><b> The formal research of semantics intersects with many other fields of inquiry,including lexicology, syntax, pragmatics, etymology and others, although semantics is a well-defined field in its own right, often with synthetic properties.In philosophy of language, semantics and reference are related fields. Further related fields include philology, communication, and semiotics. </b></div>javagurlhttp://www.blogger.com/profile/03043905618991939932noreply@blogger.com0