<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1330217516651230937</id><updated>2012-01-30T02:38:32.624-08:00</updated><title type='text'>Best Java Knowledge</title><subtitle type='html'>Javaequation provide you the Best knowledge about the java programming. This platform clear your all concept and solve ur all doubt.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://javaequation.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://javaequation.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Raman Taneja</name><uri>http://www.blogger.com/profile/02519255746353479543</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-e1bep17DMpg/Tibl9hKq9hI/AAAAAAAAANk/wNZI30LoAhM/s220/RT.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>21</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1330217516651230937.post-2569363773445660054</id><published>2012-01-23T05:28:00.000-08:00</published><updated>2012-01-30T02:38:32.641-08:00</updated><title type='text'>Difference Between Java and WordPress</title><content type='html'>ava and WordPress are very much different, this is an attempt to compare and see where they intersect each other.&lt;br /&gt;&lt;br /&gt;Java&lt;br /&gt;&lt;br /&gt;Java is an enterprise Language, what it means it is used to build enterprise applications, what do we mean by that?&lt;br /&gt;&lt;br /&gt;· A variety of clients can interact with applications like browsers, smart tablets, B2B applications, .NET and other language apps.&lt;br /&gt;&lt;br /&gt;· High Security to support the standards.&lt;br /&gt;&lt;br /&gt;· Highly Scalable to support the growing traffic.&lt;br /&gt;&lt;br /&gt;· Performance - Begin compile time performance is high.&lt;br /&gt;&lt;br /&gt;· E.g applications are Gaming, ECommerce websites, Billing, Retail, CRM and tons of others&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.backlinksgenius.com/#26248adb2086c37b65392884449f8d49"&gt;&lt;img src="http://www.backlinksgenius.com/web/upload/userfiles/images/bloger_468x60_f.gif" class="" style="" alt="Earn Cash by using your WordPress" height="60" width="468" /&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Java can be used to create blogging CMS like WordPress. There are CMS's like alfresco, Plone, JRoller whodo to attempt to that, but none has been able so popular as WordPress.&lt;br /&gt;&lt;br /&gt;WordPress&lt;br /&gt;&lt;br /&gt;Very specialized CMS/blogging engine build on top of PHP.&lt;br /&gt;&lt;br /&gt;· It is very easy to learn software, compare it to learning MS Word.&lt;br /&gt;&lt;br /&gt;· You don't need to know PHP/programming to be WordPress website developer.&lt;br /&gt;&lt;br /&gt;· It has a themes concept, which allows a developer to configure website pages with easy.&lt;br /&gt;&lt;br /&gt;· Supports thousands of plugins, almost easy to find any kind of functionality a website needs.&lt;br /&gt;&lt;br /&gt;· Installs on Apache Server with PHP engine.&lt;br /&gt;&lt;br /&gt;· Many hosting sites support 1 click install.&lt;br /&gt;&lt;br /&gt;· Uses MySQL as the backend engine.&lt;br /&gt;&lt;br /&gt;As you see, WordPress and Java cannot be compared as one is a language where another is a software built on PHP language.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.postsgenius.com/#a.05a92f58fba58df82d8c74501b70cf6b"&gt;&lt;img alt="Buy Blog Posts and Reviews for your Website with Posts Genius" src="http://my.postsgenius.com/style/banners/468_60_advertiser_c_en.gif" height="60" width="468" /&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;Had WordPress been written in Java&lt;br /&gt;&lt;br /&gt;As a Java Developer, I do wish WordPress was built on Java, it would have given&lt;br /&gt;&lt;br /&gt;1. Java applications a web flair, we would have to see all together new set of applications /widgets/ plugins.&lt;br /&gt;&lt;br /&gt;2. Designers would have not been scared of the language at all.&lt;br /&gt;&lt;br /&gt;3. Applications could have used the WordPress database, which has a very simple schema.&lt;br /&gt;&lt;br /&gt;WordPress And Java Together&lt;br /&gt;&lt;br /&gt;Resin Quercus&lt;br /&gt;&lt;br /&gt;Resin is a Java Application server, but with a twist, it has a Quercus engine which allow PHP applications to installed as Java applications.&lt;br /&gt;&lt;br /&gt;What does this mean, if a WordPress can be installed on Resin will run as a Java application and also take advantage of libraries like Spring, Hibernate,SOA.&lt;br /&gt;&lt;br /&gt;Also, will definitely perform way better as it will be compiled only once and not be interpreted with every request like it does now&lt;br /&gt;&lt;br /&gt;To have this integration working has its own challenges but good news is there is a way.&lt;br /&gt;&lt;br /&gt;Summary&lt;br /&gt;&lt;br /&gt;While WordPress has it own niche, creating CMS websites with blog functionality, it is the DeFacto Platform.&lt;br /&gt;&lt;br /&gt;But when it comes to creating highly scalable enterprise Applications Java is the DeFacto Platform.&lt;br /&gt;&lt;br /&gt;Makarand Bhatamrekar is a enterprise Java RIA Career Coach. He has been coaching since 2007 on Java technologies to help trainees achieve their java career goals. http://careerInJava.com is a dedicated the effort to give all the resources needed to succeed.&lt;br /&gt;To be informed of the latest update, do subscribe the Newsletter at http://www.careerInJava.com&lt;br /&gt;&lt;br /&gt;WordPress is the easiest CMS out here, which allows to create your website with no knowledge of PHP. Makarand was able to develop coaching website on WordPress with no prior knowledge of the same, hence this post comparing the two.&lt;br /&gt;&lt;br /&gt;Article Source: http://EzineArticles.com/6811651&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.obiq.se"&gt;utvecklare intranet&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1330217516651230937-2569363773445660054?l=javaequation.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaequation.blogspot.com/feeds/2569363773445660054/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaequation.blogspot.com/2012/01/difference-between-java-and-wordpress.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/2569363773445660054'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/2569363773445660054'/><link rel='alternate' type='text/html' href='http://javaequation.blogspot.com/2012/01/difference-between-java-and-wordpress.html' title='Difference Between Java and WordPress'/><author><name>Raman Taneja</name><uri>http://www.blogger.com/profile/02519255746353479543</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-e1bep17DMpg/Tibl9hKq9hI/AAAAAAAAANk/wNZI30LoAhM/s220/RT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1330217516651230937.post-3963424417662674184</id><published>2011-07-20T05:29:00.000-07:00</published><updated>2011-07-20T05:32:19.696-07:00</updated><title type='text'>Why Java RDBMS?</title><content type='html'>It is a well known fact that Java as a programming language set off a new paradigm in the software industry. Suddenly, every software programmer worth his salt was amidst software jargons like 'Platform-Independence', 'Cross-Platform-Deployment' and 'The Java Virtual Machine'. In fact, it did not take long for Java to usurp the 'most sought after status' from many software languages, and become the most preferred tool for creating software; especially software for the web. As the recent trends in the industry show, Java is set to achieve an undeniable position as the most preferred software programming language for a long time to come. It is indeed Java's credit that many prominent vendors who tried to emulate the capacities of Java, failed miserably in the endeavor.&lt;br /&gt;&lt;br /&gt;The importance of Java in the software scenario has led to another major trend. Software vendors are either rewriting their existing products in Java, or are creating new products exclusively or partially in Java. This has led many analysts to question the need to port already existing applications to Java. While the prospects of porting small or medium sized software to Java may not attract concern, it assumes significance when we consider porting existing databases that could be handling millions of sensitive blocks of information. Similarly, experts also have to decide between deploying reputed databases, and new databases that have been entirely developed in Java, in their organizations. Analysts have to answer many pertinent questions like: What are the advantages of a Java RDBMS that would compel my company to switch to it? Would it be cost effective to change to an RDBMS that has all the advantages of Java? Would the costs involved in porting millions of existing records justify the perceived performance and scalability features of the Java RDBMS? How secure would be the new RDBMS? What is the learning curve that has to be tackled by the staff who may be assigned to this database? In fact, there are a host of questions that a concerned technical head may ask himself before taking that all important decision to switch to a Java RDBMS. Let's try finding out some of the answers.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;What are the advantages of a Java RDBMS?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;OK, so we all know that Java is set to capture, or has already captured a sizeable chunk of the software market. However, how does that justify the use of a Java Database? After all, is not Java theoretically capable of integrating with any database? What advantages can be afforded by a Java RDBMS?&lt;br /&gt;&lt;br /&gt;Well the answer is quite simple. Java RDBMS has, or supports, the much sought after qualities of Java, which is the most important reason to switch to it. Some of the Java RDBMS already available in the markets answers the immediate concerns of the Technical Lead in the most persuasive manner. For example, Daffodil DB, an RDBMS written in Java, considers the following as its core strengths:&lt;br /&gt;&lt;br /&gt;Multiple Platform Portability&lt;br /&gt;&lt;br /&gt;Small Size&lt;br /&gt;&lt;br /&gt;Java Stored Procedures&lt;br /&gt;&lt;br /&gt;Transparent to End User&lt;br /&gt;&lt;br /&gt;Zero Administration Efforts&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Some of these features are worth a second look.&lt;br /&gt;&lt;br /&gt;One RDBMS, multiple avatars&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Java RDBMS not only offers the advantages of Java, but also introduces new concepts that can revolutionize database programming techniques. For a start, the much famed portability of Java is the core strength of a Java RDBMS. Now, you don't have to buy different RDBMS for different platforms within the same enterprise. Other than the cost factors, the biggest advantage such an arrangement can give is that in-house code need not be redesigned for different platforms. By standardizing the database that is used, programs working across platforms can interact transparently and effectively. Project managers would vouch that portability, synchronization and customization effort for software running on different platforms are some of the most time consuming and tension filled activities in the office. Now all these activities can be easily implemented with the Java RDBMS in its rightful place.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Store and use those procedures with abandon&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Security buffs within the enterprise would always throw a tantrum when dealing with stored procedures. Traditionally, the implementation of stored procedures had been the responsibility of the specific application vendor, and most of them could crash the whole database due to internal errors, rendering precious time and money waste. Java stored procedures with its inbuilt security features is the new fad of security administrators who are finding it powerful, fast, and very safe. Java does not implement Pointers, and so is a safe bet for developers to write secure code and procedures. In addition, with the JVM overlooking all the activities (the sandbox approach), there is no scope for external access that could jeopardize mission critical enterprise applications.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Transparent to End User&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Java technologies have always been in the forefront to give us seamless transparent applications with inbuilt security features being given the utmost importance. In a Java RDBMS, database components can be embedded in applications, and they can perform complex tasks without user intervention. In addition, the user need not know the complexities of the database because the embedded database components will do all the work for him without him even knowing about it. This allows the user to concentrate on his tasks rather than configuring databases, which is an auxiliary requirement. In addition, other routine activities like starting the server and repetitive configuring of the database can also be avoided. Perhaps the biggest advantage that Java RDBMS offers is that the user need not weigh the pros and cons about choosing a database vendor. This is because Java RDBMS being extremely portable can seamlessly integrate with almost all platforms, and the embedded components will handle all the chores of integrating with different vendor software. Java RDBMS can also be seamlessly operated across multiple platforms without the need to configure the database for each and every operating system.&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Zero Administration Efforts&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Java RDBMS comes in with zero administration efforts, which means that once installed and configured, your clients need not change their settings to suit new changes that you make in your database. Java RDBMS also does away with, or considerably reduces, the role of the Database Administrator because of its self-managed features, and its extremely scalable mode of operation.&lt;br /&gt;&lt;br /&gt;If you have not thought of it yet, it is a good time to think about Java RDBMS. The time is not far away when the databases industry will be greatly influenced by the power and functionality of Java RDBMS.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Article Source: http://EzineArticles.com/3103&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1330217516651230937-3963424417662674184?l=javaequation.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaequation.blogspot.com/feeds/3963424417662674184/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaequation.blogspot.com/2011/07/why-java-rdbms.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/3963424417662674184'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/3963424417662674184'/><link rel='alternate' type='text/html' href='http://javaequation.blogspot.com/2011/07/why-java-rdbms.html' title='Why Java RDBMS?'/><author><name>Raman Taneja</name><uri>http://www.blogger.com/profile/02519255746353479543</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-e1bep17DMpg/Tibl9hKq9hI/AAAAAAAAANk/wNZI30LoAhM/s220/RT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1330217516651230937.post-4940240837503084038</id><published>2011-01-24T05:53:00.002-08:00</published><updated>2012-01-20T01:44:18.481-08:00</updated><title type='text'>BASIC CONCEPTS OF JAVA</title><content type='html'>Now that already we have seen large characteristics what Java can offer us, and before entering to bag in the generation of our first code Java, we are going to glance over the language Java in itself.  The basic thing relative to the ones will result very that have know-how of C/C+ +.  The programmers with experience in other languages procedurales will recognize most of the constructions.  We expect that this chapter result not too intense, nevertheless, yes should been present, because more than one time we will resort to him as reference.  In subsequent chapters we will deepen on aspects of the programming in Java by the ones that here we will pass on tiptoe and we will go presenting examples of code of each one of those aspects of the programming in Java.&lt;br /&gt;&lt;br /&gt;If really it wants to dominate Java, is not sufficient to know the code.  You should begin to think as a programmer, and in this new edition of his guide of best-seller, Java Concepts, programming Cay Horstmann guru shows him how.  It brought up to date to integrate Java 6, Concepts of Java, fifth edition is an introduction to the techniques of fundamental programming and the abilities of design that are crucial to learn to plan.  Basing on its many years of experience as expert programmer and professor, Horstmann shows the most important elements of the data processing, troubleshooting and the design of the program.  Thanks to the formula tested Horstmann, you will be able to complete this book with a solid base in the concepts of programming and troubleshooting and to arrive quickly to the velocity to write program efficient and successful. You Can find the &lt;a href="http://javaequation.blogspot.com/"&gt;Best Java Knowledge&lt;/a&gt; Concepts here exclusive on &lt;a href="http://javaequation.blogspot.com/"&gt;javaequation.blogspot.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Characteristics of the fifth new edition:  * The focus "gradual Objects" conducts you to step oriented to objects thinking to step, the use of classes, the application of simple methods, until coming to design its own programs oriented to objects.  * A strong emphasis in the development based on tests invites to consider the results as is written the code of programming so that a better design, that can be utilized more you program * unique Focus goes beyond the syntax of the language to be concentrate on concepts of data processing and troubleshooting, that encourage to think like a solucionador of problems * New and learning teaching tools in WileyPLUS -&lt;br /&gt;including a corrector of unique allocation that will permit you to put to test your problems of programming in line before submitting them to a degree * Useful "the tests in trail" he introduces the techniques and tools step by step, what guarantees a teacher before passing to the following one * The graphics are themes developed gradually along the text, conveniently noticeable in different sections by color * The cover of updating is completely compatible with Java 5 and includes a discussion of the last characteristics of Java 6.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.etgs.org.uk/site/schoolofcomputing.asp"&gt;computer courses london&lt;/a&gt; : Ethames graduate school is a leader in computer courses London. This school of computing has the world's best faculty and teaching material.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.laptop-power.co.uk/"&gt;Laptop Chargers&lt;/a&gt; :- Laptop Charger: Laptop Power UK provide Laptop Adapters, Laptop Chargers, AC Adapters from Dell, Acer, Sony, HP, Compaq and all other top brands. Buy Online today from Laptop Power UK&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1330217516651230937-4940240837503084038?l=javaequation.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaequation.blogspot.com/feeds/4940240837503084038/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaequation.blogspot.com/2011/01/basic-concepts-of-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/4940240837503084038'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/4940240837503084038'/><link rel='alternate' type='text/html' href='http://javaequation.blogspot.com/2011/01/basic-concepts-of-java.html' title='BASIC CONCEPTS OF JAVA'/><author><name>Raman Taneja</name><uri>http://www.blogger.com/profile/02519255746353479543</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-e1bep17DMpg/Tibl9hKq9hI/AAAAAAAAANk/wNZI30LoAhM/s220/RT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1330217516651230937.post-921441384034409071</id><published>2011-01-24T05:53:00.001-08:00</published><updated>2011-01-24T05:53:39.893-08:00</updated><title type='text'>My Aim Language Java</title><content type='html'>These annotations of the language Java are the hyphen structured of a course of Introduction to the Language Java.  They are not a reference exahustiva of the language but they intend to provide a progressive approximation, leaving from it more elementary and introducing the concepts in an orderly fashion, being supported in the previous thing.&lt;br /&gt;&lt;br /&gt;They are structured in the shape of brief lessons, that cover all the aspects of the language in a basic-medium level.  Itself they are not assumed know-how of other programming languages, although obviously to be familiarized with concepts relating to the programming as variable, algorithms, objects, etc. facilitates a lot of the task.  Nevertheless, the reference has been avoided deliberately or the comparison with other languages, especially with C/C + + that so present is in many texts of Java.&lt;br /&gt;&lt;br /&gt;The first part of these annotations covers all the aspects of the language (Classes, Interfaces, inheritance, control of flow, types of data, etc.).  The second part, at present in elaboration, treats matters of the API of Java, grouping them for themes (Entrance/Exit, Threads, applets, etc.).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1330217516651230937-921441384034409071?l=javaequation.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaequation.blogspot.com/feeds/921441384034409071/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaequation.blogspot.com/2011/01/my-aim-language-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/921441384034409071'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/921441384034409071'/><link rel='alternate' type='text/html' href='http://javaequation.blogspot.com/2011/01/my-aim-language-java.html' title='My Aim Language Java'/><author><name>Raman Taneja</name><uri>http://www.blogger.com/profile/02519255746353479543</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-e1bep17DMpg/Tibl9hKq9hI/AAAAAAAAANk/wNZI30LoAhM/s220/RT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1330217516651230937.post-3559952658595744852</id><published>2010-07-04T01:11:00.001-07:00</published><updated>2010-07-04T01:11:51.527-07:00</updated><title type='text'>Access Control</title><content type='html'>When writing new classes, it’s a good idea to pay attention to the issue of access&lt;br /&gt;control. Recall that making a member of a class public makes it accessible from anywhere, including from other classes. On the other hand, a private member can&lt;br /&gt;only be used in the class where it is defined.&lt;br /&gt;In the opinion of many programmers, almost all member variables should be declared&lt;br /&gt;private. This gives you complete control over what can be done with the&lt;br /&gt;variable. Even if the variable itself is private, you can allow other classes to find out&lt;br /&gt;what its value is by providing a public accessor method that returns the value of&lt;br /&gt;the variable. For example, if your class contains a private member variable, title,&lt;br /&gt;of type String, you can provide a method&lt;br /&gt;public String getTitle() { return title; }&lt;br /&gt;that returns the value of title. By convention, the name of an accessor method for&lt;br /&gt;a variable is obtained by capitalizing the name of variable and adding “get” in front&lt;br /&gt;of the name. So, for the variable title, we get an accessor method named “get” +&lt;br /&gt;“Title”, or getTitle(). Because of this naming convention, accessor methods are&lt;br /&gt;more often referred to as getter methods. A getter method provides “read access” to&lt;br /&gt;a variable.&lt;br /&gt;You might also want to allow “write access” to a private variable. That is, you&lt;br /&gt;might want to make it possible for other classes to specify a new value for the variable.&lt;br /&gt;This is done with a setter method. (If you don’t like simple, Anglo-Saxon&lt;br /&gt;words, you can use the fancier term mutator method.) The name of a setter method&lt;br /&gt;should consist of “set” followed by a capitalized copy of the variable’s name, and it&lt;br /&gt;should have a parameter with the same type as the variable. A setter method for the&lt;br /&gt;variable title could be written&lt;br /&gt;public void setTitle( String newTitle ) { title = newTitle; }&lt;br /&gt;It is actually very common to provide both a getter and a setter method for a&lt;br /&gt;private member variable. Since this allows other classes both to see and to change&lt;br /&gt;the value of the variable, you might wonder why not just make the variable public?&lt;br /&gt;The reason is that getters and setters are not restricted to simply reading and writing&lt;br /&gt;the variable’s value. In fact, they can take any action at all. For example, a getter&lt;br /&gt;method might keep track of the number of times that the variable has been accessed:&lt;br /&gt;public String getTitle() {&lt;br /&gt;titleAccessCount++; / / Increment member v a r i a b l e t i t leAc ces sCount .&lt;br /&gt;return title;&lt;br /&gt;}&lt;br /&gt;and a setter method might check that the value that is being assigned to the variable&lt;br /&gt;is legal:&lt;br /&gt;public void setTitle( String newTitle ) {&lt;br /&gt;if ( newTitle == null ) / / Don ’ t al low n u l l s t r i n g s as t i t l e s !&lt;br /&gt;title = " ( Unt i t led ) "; / / Use an appropr iate d e f a u l t value instead .&lt;br /&gt;else&lt;br /&gt;title = newTitle; }&lt;br /&gt;Even if you can’t think of any extra chores to do in a getter or setter method, you&lt;br /&gt;might change your mind in the future when you redesign and improve your class. If&lt;br /&gt;you’ve used a getter and setter from the beginning, you can make the modification&lt;br /&gt;to your class without affecting any of the classes that use your class. The private&lt;br /&gt;member variable is not part of the public interface of your class; only the public&lt;br /&gt;getter and setter methods are. If you haven’t used get and set from the beginning,&lt;br /&gt;you’ll have to contact everyone who uses your class and tell them, “Sorry guys, you’ll&lt;br /&gt;have to track down every use that you’ve made of this variable and change your code.”&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1330217516651230937-3559952658595744852?l=javaequation.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaequation.blogspot.com/feeds/3559952658595744852/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaequation.blogspot.com/2010/07/access-control.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/3559952658595744852'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/3559952658595744852'/><link rel='alternate' type='text/html' href='http://javaequation.blogspot.com/2010/07/access-control.html' title='Access Control'/><author><name>Raman Taneja</name><uri>http://www.blogger.com/profile/02519255746353479543</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-e1bep17DMpg/Tibl9hKq9hI/AAAAAAAAANk/wNZI30LoAhM/s220/RT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1330217516651230937.post-8980660566452568564</id><published>2010-07-04T01:07:00.000-07:00</published><updated>2010-07-04T01:10:37.493-07:00</updated><title type='text'>Class Members and Instance Members</title><content type='html'>A class definition is made of members or components. A class can define variables (or&lt;br /&gt;fields) and methods. Variables and methods can be static or non-static i.e. they are&lt;br /&gt;defined with or without the keyword static.&lt;br /&gt;e.g.&lt;br /&gt;static double lastStudentNumber; / / a s t a t i c member / v a r i a b l e / f i e l d&lt;br /&gt;double studentNumber; / / a non−s t a t i c v a r i a b l e&lt;br /&gt;static void printLastNumber() {...} / / a s t a t i c member /method&lt;br /&gt;void printNumber() {...} / / a non−s t a t i c method&lt;br /&gt;The non-static members of a class (variables and methods) are also known as&lt;br /&gt;instance variables and methods while the non-static members are also known as class&lt;br /&gt;variables and class methods. Each instance of a class (each object) gets its own copy of&lt;br /&gt;all the instance variables defined in the class. When you create an instance of a class,&lt;br /&gt;the system allocates enough memory for the object and all its instance variables.&lt;br /&gt;In addition to instance variables, classes can declare class variables. A class variable&lt;br /&gt;contains information that is shared by all instances (objects) of the class. If one&lt;br /&gt;object changes the variable, it changes for all other objects of that type. e.g. A Student&lt;br /&gt;number generator in a NewStudent class.&lt;br /&gt;You can invoke a class method directly from the class, whereas you must invoke&lt;br /&gt;instance methods on a particular instance. e.g. The methods in the Math class are&lt;br /&gt;static and can be invoked without creating an instance of the Math class for e.g. we&lt;br /&gt;can say Math.sqrt(x).&lt;br /&gt;Consider a simple class whose job is to group together a few static member variables&lt;br /&gt;for example a class could be used to store information about the person who is&lt;br /&gt;using the program:&lt;br /&gt;class UserData { static String name; static int age; }&lt;br /&gt;In programs that use this class, there is one copy each of the variables UserData.name&lt;br /&gt;and UserData.age. There can only be one “user,” since we only have memory space&lt;br /&gt;to store data about one user. The class, UserData, and the variables it contains exist&lt;br /&gt;as long as the program runs. Now, consider a similar class that includes non-static&lt;br /&gt;variables:&lt;br /&gt;class PlayerData { String name; int age; }&lt;br /&gt;In this case, there is no such variable as PlayerData.name or PlayerData.age,&lt;br /&gt;since name and age are not static members of PlayerData. There is nothing much in the class except the potential to create objects. But, it’s a lot of potential, since&lt;br /&gt;it can be used to create any number of objects! Each object will have its own variables&lt;br /&gt;called name and age. There can be many “players” because we can make new&lt;br /&gt;objects to represent new players on demand. A program might use this class to store&lt;br /&gt;information about multiple players in a game. Each player has a name and an age.&lt;br /&gt;When a player joins the game, a new PlayerData object can be created to represent&lt;br /&gt;that player. If a player leaves the game, the PlayerData object that represents that&lt;br /&gt;player can be destroyed. A system of objects in the program is being used to dynamically&lt;br /&gt;model what is happening in the game. You can’t do this with “static” variables!&lt;br /&gt;An object that belongs to a class is said to be an instance of that class and the&lt;br /&gt;variables that the object contains are called instance variables. The methods that&lt;br /&gt;the object contains are called instance methods.&lt;br /&gt;For example, if the PlayerData class, is used to create an object, then that object&lt;br /&gt;is an instance of the PlayerData class, and name and age are instance variables in the&lt;br /&gt;object. It is important to remember that the class of an object determines the types&lt;br /&gt;of the instance variables; however, the actual data is contained inside the individual&lt;br /&gt;objects, not the class. Thus, each object has its own set of data.&lt;br /&gt;The source code for methods are defined in the class yet it’s better to think of the&lt;br /&gt;instance methods as belonging to the object, not to the class. The non-static methods&lt;br /&gt;in the class merely specify the instance methods that every object created from the&lt;br /&gt;class will contain. For example a draw() method in two different objects do the same&lt;br /&gt;thing in the sense that they both draw something. But there is a real difference&lt;br /&gt;between the two methods—the things that they draw can be different. You might&lt;br /&gt;say that the method definition in the class specifies what type of behavior the objects&lt;br /&gt;will have, but the specific behavior can vary from object to object, depending on the&lt;br /&gt;values of their instance variables.&lt;br /&gt;The static and the non-static portions of a class are very different things and serve&lt;br /&gt;very different purposes. Many classes contain only static members, or only non-static.&lt;br /&gt;However, it is possible to mix static and non-static members in a single class. The&lt;br /&gt;“static” definitions in the source code specify the things that are part of the class itself,&lt;br /&gt;whereas the non-static definitions in the source code specify things that will become&lt;br /&gt;part of every instance object that is created from the class. Static member variables&lt;br /&gt;and static member methods in a class are sometimes called class variables and&lt;br /&gt;class methods, since they belong to the class itself, rather than to instances of that&lt;br /&gt;class.&lt;br /&gt;So far, we’ve been talking mostly in generalities. Let’s now look at a specific&lt;br /&gt;example to see how classes and objects work. Consider this extremely simplified&lt;br /&gt;version of a Student class, which could be used to store information about students&lt;br /&gt;taking a course:&lt;br /&gt;public class Student {&lt;br /&gt;public String name; / / Student ’ s name . p u b l i c double test1 ,&lt;br /&gt;test2, test3; / / Grades on three t e s t s .&lt;br /&gt;public double getAverage() { / / compute average t e s t grade r e t u r n&lt;br /&gt;(test1 + test2 + test3) / 3; }&lt;br /&gt;} / / end of class Student&lt;br /&gt;None of the members of this class are declared to be static, so the class exists&lt;br /&gt;only for creating objects. This class definition says that any object that is an instance of the Student class will include instance variables named name, test1, test2, and&lt;br /&gt;test3, and it will include an instance method named getAverage(). The names&lt;br /&gt;and tests in different objects will generally have different values. When called for&lt;br /&gt;a particular student, the method getAverage() will compute an average using that&lt;br /&gt;student’s test grades. Different students can have different averages. (Again, this is&lt;br /&gt;what it means to say that an instance method belongs to an individual object, not to&lt;br /&gt;the class.)&lt;br /&gt;In JAVA, a class is a type, similar to the built-in types such as int and boolean.&lt;br /&gt;So, a class name can be used to specify the type of a variable in a declaration statement,&lt;br /&gt;the type of a formal parameter, or the return type of a method. For example, a&lt;br /&gt;program could define a variable named std of type Student with the statement&lt;br /&gt;Student std;&lt;br /&gt;However, declaring a variable does not create an object! This is an important&lt;br /&gt;point, which is related to this Very Important Fact:&lt;br /&gt;In JAVA, no variable can ever hold an object. A variable can only hold a&lt;br /&gt;reference to an object.&lt;br /&gt;You should think of objects as floating around independently in the computer’s&lt;br /&gt;memory. In fact, there is a special portion of memory called the heap where objects&lt;br /&gt;live. Instead of holding an object itself, a variable holds the information necessary&lt;br /&gt;to find the object in memory. This information is called a reference or pointer to the&lt;br /&gt;object. In effect, a reference to an object is the address of the memory location where&lt;br /&gt;the object is stored. When you use a variable of class type, the computer uses the&lt;br /&gt;reference in the variable to find the actual object.&lt;br /&gt;In a program, objects are created using an operator called new, which creates an&lt;br /&gt;object and returns a reference to that object. For example, assuming that std is a&lt;br /&gt;variable of type Student, declared as above, the assignment statement&lt;br /&gt;std = new Student();&lt;br /&gt;would create a new object which is an instance of the class Student, and it would&lt;br /&gt;store a reference to that object in the variable std. The value of the variable is a&lt;br /&gt;reference to the object, not the object itself. It is not quite true to say that the object&lt;br /&gt;is the “value of the variable std”. It is certainly not at all true to say that the object&lt;br /&gt;is “stored in the variable std.” The proper terminology is that “the variable std refers&lt;br /&gt;to the object,”.&lt;br /&gt;So, suppose that the variable std refers to an object belonging to the class Student.&lt;br /&gt;That object has instance variables name, test1, test2, and test3. These instance&lt;br /&gt;variables can be referred to as std.name, std.test1, std.test2, and std.test3.&lt;br /&gt;This follows the usual naming convention that when B is part of A, then the full name&lt;br /&gt;of B is A.B. For example, a program might include the lines&lt;br /&gt;System.out.println(" Hello , " + std.name + " . Your tes t grades are : ");&lt;br /&gt;System.out.println(std.test1);&lt;br /&gt;System.out.println(std.test2);&lt;br /&gt;System.out.println(std.test3);&lt;br /&gt;This would output the name and test grades from the object to which std refers.&lt;br /&gt;Similarly, std can be used to call the getAverage() instance method in the object by&lt;br /&gt;saying std.getAverage(). To print out the student’s average, you could say:&lt;br /&gt;System.out.println( " Your average i s " + std.getAverage() );&lt;br /&gt;More generally, you could use std.name any place where a variable of type String&lt;br /&gt;is legal. You can use it in expressions. You can assign a value to it. You can pass it&lt;br /&gt;as a parameter to method. You can even use it to call methods from the String class.&lt;br /&gt;For example, std.name.length() is the number of characters in the student’s name.&lt;br /&gt;It is possible for a variable like std, whose type is given by a class, to refer to no&lt;br /&gt;object at all. We say in this case that std holds a null reference. The null reference&lt;br /&gt;is written in JAVA as “null”. You can store a null reference in the variable std by&lt;br /&gt;saying “std = null;” and you could test whether the value of “std” is null by testing&lt;br /&gt;“if (std == null) . . .”.&lt;br /&gt;If the value of a variable is null, then it is, of course, illegal to refer to instance&lt;br /&gt;variables or instance methods through that variable–since there is no object, and&lt;br /&gt;hence no instance variables to refer to. For example, if the value of the variable st is&lt;br /&gt;null, then it would be illegal to refer to std.test1. If your program attempts to use a&lt;br /&gt;null reference illegally like this, the result is an error called a null pointer exception.&lt;br /&gt;Let’s look at a sequence of statements that work with objects:&lt;br /&gt;Student std, std1, / / Declare four v a r i a b l e s of&lt;br /&gt;std2, std3; / / type Student .&lt;br /&gt;std = new Student(); / / Create a new objec t belonging&lt;br /&gt;/ / to the class Student , and&lt;br /&gt;/ / s tore a reference to t h a t&lt;br /&gt;/ / objec t i n the v a r i a b l e std .&lt;br /&gt;std1 = new Student(); / / Create a second Student objec t&lt;br /&gt;/ / and s tore a reference to&lt;br /&gt;/ / i t i n the v a r i a b l e std1 .&lt;br /&gt;std2 = std1; / / Copy the reference value i n std1&lt;br /&gt;/ / i n t o the v a r i a b l e std2 .&lt;br /&gt;std3 = null; / / Store a n u l l reference i n the&lt;br /&gt;/ / v a r i a b l e std3 .&lt;br /&gt;std.name = " John Smith "; / / Set values of some instance v a r i a b l e s .&lt;br /&gt;std1.name = "Mary Jones ";&lt;br /&gt;/ / ( Other instance v a r i a b l e s have d e f a u l t&lt;br /&gt;/ / i n i t i a l values of zero . )&lt;br /&gt;After the computer executes these statements, the situation in the computer’s&lt;br /&gt;memory looks like this:&lt;br /&gt;This picture shows variables as little boxes, labeled with the names of the variables.&lt;br /&gt;Objects are shown as boxes with round corners. When a variable contains a&lt;br /&gt;reference to an object, the value of that variable is shown as an arrow pointing to the&lt;br /&gt;object. The variable std3, with a value of null, doesn’t point anywhere. The arrows&lt;br /&gt;from std1 and std2 both point to the same object. This illustrates a Very Important&lt;br /&gt;Point:&lt;br /&gt;When one object variable is assigned to another, only a reference is copied.&lt;br /&gt;The object referred to is not copied.&lt;br /&gt;When the assignment “std2 = std1;” was executed, no new object was created.&lt;br /&gt;Instead, std2 was set to refer to the very same object that std1 refers to. This has&lt;br /&gt;some consequences that might be surprising. For example, std1.name and std2.name&lt;br /&gt;are two different names for the same variable, namely the instance variable in the&lt;br /&gt;object that both std1 and std2 refer to. After the string “Mary Jones” is assigned to&lt;br /&gt;the variable std1.name, it is also be true that the value of std2.name is “Mary Jones”.&lt;br /&gt;There is a potential for a lot of confusion here, but you can help protect yourself from&lt;br /&gt;it if you keep telling yourself, “The object is not in the variable. The variable just&lt;br /&gt;holds a pointer to the object.”&lt;br /&gt;You can test objects for equality and inequality using the operators == and !=,&lt;br /&gt;but here again, the semantics are different from what you are used to. The test&lt;br /&gt;“if (std1 == std2)”, tests whether the values stored in std1 and std2 are the&lt;br /&gt;same. But the values are references to objects, not objects. So, you are testing&lt;br /&gt;whether std1 and std2 refer to the same object, that is, whether they point to the&lt;br /&gt;same location in memory. This is fine, if its what you want to do. But sometimes,&lt;br /&gt;what you want to check is whether the instance variables in the objects have the&lt;br /&gt;same values. To do that, you would need to ask whether&lt;br /&gt;std1.test1 == std2.test1 &amp;&amp; std1.test2 == std2.test2 &amp;&amp; std1.test3&lt;br /&gt;== std2.test3 &amp;&amp; std1.name.equals(std2.name)}&lt;br /&gt;I’ve remarked previously that Strings are objects, and I’ve shown the strings&lt;br /&gt;“Mary Jones” and “John Smith” as objects in the above illustration. A variable of type String can only hold a reference to a string, not the string itself. It could also&lt;br /&gt;hold the value null, meaning that it does not refer to any string at all. This explains&lt;br /&gt;why using the == operator to test strings for equality is not a good idea.&lt;br /&gt;The fact that variables hold references to objects, not objects themselves, has a&lt;br /&gt;couple of other consequences that you should be aware of. They follow logically, if&lt;br /&gt;you just keep in mind the basic fact that the object is not stored in the variable. The&lt;br /&gt;object is somewhere else; the variable points to it.&lt;br /&gt;Suppose that a variable that refers to an object is declared to be final. This&lt;br /&gt;means that the value stored in the variable can never be changed, once the variable&lt;br /&gt;has been initialized. The value stored in the variable is a reference to the object. So&lt;br /&gt;the variable will continue to refer to the same object as long as the variable exists.&lt;br /&gt;However, this does not prevent the data in the object from changing. The variable&lt;br /&gt;is final, not the object. It’s perfectly legal to say&lt;br /&gt;final Student stu = new Student();&lt;br /&gt;stu.name = " John Doe"; / / Change data i n the objec t ;&lt;br /&gt;/ / The value stored i n stu i s not changed !&lt;br /&gt;/ / I t s t i l l r e f e r s to the same objec t .&lt;br /&gt;Next, suppose that obj is a variable that refers to an object. Let’s consider what&lt;br /&gt;happens when obj is passed as an actual parameter to a method. The value of obj&lt;br /&gt;is assigned to a formal parameter in the method, and the method is executed. The&lt;br /&gt;method has no power to change the value stored in the variable, obj. It only has a&lt;br /&gt;copy of that value. However, that value is a reference to an object. Since the method&lt;br /&gt;has a reference to the object, it can change the data stored in the object. After the&lt;br /&gt;method ends, obj still points to the same object, but the data stored in the object&lt;br /&gt;might have changed. Suppose x is a variable of type int and stu is a variable of type&lt;br /&gt;Student. Compare:&lt;br /&gt;void dontChange(int z) { void change(Student s) {&lt;br /&gt;z = 42; s.name = " Fred ";&lt;br /&gt;} }&lt;br /&gt;The lines: The lines:&lt;br /&gt;x = 17; stu.name = " Jane";&lt;br /&gt;dontChange(x); change(stu);&lt;br /&gt;System.out.println(x); System.out.println(stu.name);&lt;br /&gt;outputs the value 17. outputs the value " Fred ".&lt;br /&gt;The value of x is not The value of stu is not changed ,&lt;br /&gt;changed by the method, but stu.name is.&lt;br /&gt;which is equivalent to This is equivalent to&lt;br /&gt;z = x; s = stu;&lt;br /&gt;z = 42; s.name = " Fred ";&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1330217516651230937-8980660566452568564?l=javaequation.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaequation.blogspot.com/feeds/8980660566452568564/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaequation.blogspot.com/2010/07/class-members-and-instance-members.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/8980660566452568564'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/8980660566452568564'/><link rel='alternate' type='text/html' href='http://javaequation.blogspot.com/2010/07/class-members-and-instance-members.html' title='Class Members and Instance Members'/><author><name>Raman Taneja</name><uri>http://www.blogger.com/profile/02519255746353479543</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-e1bep17DMpg/Tibl9hKq9hI/AAAAAAAAANk/wNZI30LoAhM/s220/RT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1330217516651230937.post-5890524856559012302</id><published>2010-07-04T01:06:00.001-07:00</published><updated>2010-07-04T01:06:54.190-07:00</updated><title type='text'>Enums and for-each Loops</title><content type='html'>Java 5.0 introduces a new “enhanced” form of the for loop that is designed to be&lt;br /&gt;convenient for processing data structures. A data structure is a collection of data&lt;br /&gt;items, considered as a unit. For example, a list is a data structure that consists&lt;br /&gt;simply of a sequence of items. The enhanced for loop makes it easy to apply the&lt;br /&gt;same processing to every element of a list or other data structure. However, one of&lt;br /&gt;the applications of the enhanced for loop is to enum types, and so we consider it&lt;br /&gt;briefly here.&lt;br /&gt;The enhanced for loop can be used to perform the same processing on each of the&lt;br /&gt;enum constants that are the possible values of an enumerated type. The syntax for&lt;br /&gt;doing this is:&lt;br /&gt;for ( enum−type−name variable−name : enum−type−name.values() )&lt;br /&gt;statement&lt;br /&gt;or&lt;br /&gt;for ( enum−type−name variable−name : enum−type−name.values() ) {&lt;br /&gt;statements&lt;br /&gt;}&lt;br /&gt;If MyEnum is the name of any enumerated type, then MyEnum.values() is a method&lt;br /&gt;call that returns a list containing all of the values of the enum. (values() is a static&lt;br /&gt;member method in MyEnum and of any other enum.) For this enumerated type, the&lt;br /&gt;for loop would have the form:&lt;br /&gt;for ( MyEnum variable−name : MyEnum.values() )&lt;br /&gt;statement&lt;br /&gt;The intent of this is to execute the statement once for each of the possible values of&lt;br /&gt;the MyEnum type. The variable-name is the loop control variable. In the statement,&lt;br /&gt;it represents the enumerated type value that is currently being processed. This variable&lt;br /&gt;should not be declared before the for loop; it is essentially being declared in the&lt;br /&gt;loop itself.&lt;br /&gt;To give a concrete example, suppose that the following enumerated type has been&lt;br /&gt;defined to represent the days of the week:&lt;br /&gt;enum Day { MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY }&lt;br /&gt;Then we could write:&lt;br /&gt;for ( Day d : Day.values() ) {&lt;br /&gt;System.out.print( d );&lt;br /&gt;System.out.print(" i s day number ");&lt;br /&gt;System.out.println( d.ordinal() );&lt;br /&gt;}&lt;br /&gt;Day.values() represents the list containing the seven constants that make up the&lt;br /&gt;enumerated type. The first time through this loop, the value of d would be the first&lt;br /&gt;enumerated type value Day.MONDAY, which has ordinal number 0, so the output&lt;br /&gt;would be “MONDAY is day number0”. The second time through the loop, the value&lt;br /&gt;of d would be Day.TUESDAY, and so on through Day.SUNDAY. The body of the loop&lt;br /&gt;is executed once for each item in the list Day.values(), with d taking on each of those&lt;br /&gt;values in turn. The full output from this loop would be:&lt;br /&gt;MONDAY is day number 0&lt;br /&gt;TUESDAY is day number 1&lt;br /&gt;WEDNESDAY is day number 2&lt;br /&gt;THURSDAY is day number 3&lt;br /&gt;FRIDAY is day number 4&lt;br /&gt;SATURDAY is day number 5&lt;br /&gt;SUNDAY is day number 6&lt;br /&gt;Since the intent of the enhanced for loop is to do something “for each” item in a&lt;br /&gt;data structure, it is often called a for-each loop. The syntax for this type of loop is&lt;br /&gt;unfortunate. It would be better if it were written something like “foreach Day d in&lt;br /&gt;Day.values()”, which conveys the meaning much better and is similar to the syntax&lt;br /&gt;used in other programming languages for similar types of loops. It’s helpful to think&lt;br /&gt;of the colon (:) in the loop as meaning “in.”&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1330217516651230937-5890524856559012302?l=javaequation.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaequation.blogspot.com/feeds/5890524856559012302/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaequation.blogspot.com/2010/07/enums-and-for-each-loops.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/5890524856559012302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/5890524856559012302'/><link rel='alternate' type='text/html' href='http://javaequation.blogspot.com/2010/07/enums-and-for-each-loops.html' title='Enums and for-each Loops'/><author><name>Raman Taneja</name><uri>http://www.blogger.com/profile/02519255746353479543</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-e1bep17DMpg/Tibl9hKq9hI/AAAAAAAAANk/wNZI30LoAhM/s220/RT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1330217516651230937.post-2189566717834371380</id><published>2010-05-01T08:03:00.000-07:00</published><updated>2012-01-05T03:24:00.306-08:00</updated><title type='text'>Introduction to Enums</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.gharbuilder.com/"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 320px; height: 174px;" src="http://2.bp.blogspot.com/-spjGRfDJCw4/TwWGvyo_hXI/AAAAAAAAAPM/yD2Ge8gLfds/s320/t3g6pb5j%2Bcopy.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5694105459485541746" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.gharbuilder.com/" title="Ghar Builder"&gt;Ghar Builder&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;JAVA comes with eight built-in primitive types and a large set of types that are defined&lt;br /&gt;by classes, such as String. But even this large collection of types is not sufficient&lt;br /&gt;to cover all the possible situations that a programmer might have to deal with.&lt;br /&gt;So, an essential part of JAVA, just like almost any other programming language, is the&lt;br /&gt;ability to create new types. For the most part, this is done by defining new classes.&lt;br /&gt;But we will look here at one particular case: the ability to define enums (short for&lt;br /&gt;enumerated types). Enums are a recent addition to JAVA. They were only added in&lt;br /&gt;Version 5.0. Many programming languages have something similar.&lt;br /&gt;&lt;br /&gt;Technically, an enum is considered to be a special kind of class. In this section, we&lt;br /&gt;will look at enums in a simplified form. In practice, most uses of enums will only need&lt;br /&gt;the simplified form that is presented here.&lt;br /&gt;An enum is a type that has a fixed list of possible values, which is specified&lt;br /&gt;when the enum is created.&lt;br /&gt;In some ways, an enum is similar to the boolean data type, which has true and false&lt;br /&gt;as its only possible values. However, boolean is a primitive type, while an enum is&lt;br /&gt;not.&lt;br /&gt;The definition of an enum types has the (simplified) form:&lt;br /&gt;enum enum−type−name { list−of−enum−values };&lt;br /&gt;This definition cannot be inside a method. You can place it outside the main()&lt;br /&gt;method of the program. The enum−type−name can be any simple identifier. This&lt;br /&gt;identifier becomes the name of the enum type, in the same way that “boolean” is the&lt;br /&gt;name of the boolean type and “String” is the name of the String type. Each value in&lt;br /&gt;the list−of−enum−values must be a simple identifier, and the identifiers in the list&lt;br /&gt;are separated by commas. For example, here is the definition of an enum type named&lt;br /&gt;Season whose values are the names of the four seasons of the year:&lt;br /&gt;enum Season { SPRING, SUMMER, AUTUMN, WINTER };&lt;br /&gt;By convention, enum values are given names that are made up of upper case letters,&lt;br /&gt;but that is a style guideline and not a syntax rule. Enum values are not variables.&lt;br /&gt;Each value is a constant that always has the same value. In fact, the possible&lt;br /&gt;values of an enum type are usually referred to as enum constants.&lt;br /&gt;Note that the enum constants of type Season are considered to be “contained in”&lt;br /&gt;Season, which means–following the convention that compound identifiers are used&lt;br /&gt;for things that are contained in other things–the names that you actually use in your&lt;br /&gt;program to refer to them are Season.SPRING, Season.SUMMER, Season.AUTUMN, and&lt;br /&gt;Season.WINTER.&lt;br /&gt;Once an enum type has been created, it can be used to declare variables in exactly&lt;br /&gt;the same ways that other types are used. For example, you can declare a variable&lt;br /&gt;named vacation of type Season with the statement:&lt;br /&gt;Season vacation;&lt;br /&gt;After declaring the variable, you can assign a value to it using an assignment&lt;br /&gt;statement. The value on the right-hand side of the assignment can be one of the enum&lt;br /&gt;constants of type Season. Remember to use the full name of the constant, including&lt;br /&gt;“Season”! For example: vacation = Season.SUMMER;.&lt;br /&gt;You can print an enum value with the statement: System.out.print(vacation).&lt;br /&gt;The output value will be the name of the enum constant (without the “Season.”). In&lt;br /&gt;this case, the output would be “SUMMER”.&lt;br /&gt;Because an enum is technically a class, the enum values are technically objects.&lt;br /&gt;As objects, they can contain methods. One of the methods in every enum value is&lt;br /&gt;ordinal(). When used with an enum value it returns the ordinal number of the&lt;br /&gt;value in the list of values of the enum. The ordinal number simply tells the position&lt;br /&gt;of the value in the list. That is, Season.SPRING.ordinal() is the int value&lt;br /&gt;0, Season.SUMMER.ordinal() is 1, while 2 is Season.AUTUMN.ordinal(), and 3 is&lt;br /&gt;Season.WINTER.ordinal() is. You can use the ordinal() method with a variable of&lt;br /&gt;type Season, such as vacation.ordinal() in our example.&lt;br /&gt;You should appreciate enums as the first example of an important concept: creating&lt;br /&gt;new types. Here is an example that shows enums being used in a complete&lt;br /&gt;program:&lt;br /&gt;public class EnumDemo {&lt;br /&gt;/ / Define two enum types−−d e f i n i t i o n s go OUTSIDE The main ( ) r o u t i n e !&lt;br /&gt;enum Day { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY }&lt;br /&gt;enum Month { JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC }&lt;br /&gt;public static void main(String[] args) {&lt;br /&gt;Day tgif; / / Declare a v a r i a b l e of type Day .&lt;br /&gt;Month libra; / / Declare a v a r i a b l e of type Month .&lt;br /&gt;tgif = Day.FRIDAY; / / Assign a value of type Day to t g i f .&lt;br /&gt;libra = Month.OCT; / / Assign a value of type Month to l i b r a .&lt;br /&gt;System.out.print("My s ign i s l ibra , since I was born in ");&lt;br /&gt;System.out.println(libra); / / Output value w i l l be : OCT&lt;br /&gt;System.out.print(" That ’ s the ");&lt;br /&gt;System.out.print( libra.ordinal() );&lt;br /&gt;System.out.println("−th month of the year . ");&lt;br /&gt;System.out.println(" (Counting from 0 , of course ! ) ");&lt;br /&gt;System.out.print(" I sn ’ t i t nice to get to ");&lt;br /&gt;System.out.println(tgif); / / Output value w i l l be : FRIDAY&lt;br /&gt;System.out.println( tgif + " i s the " + tgif.ordinal()&lt;br /&gt;+ "−th day of the week. "); / / Can concatenate enum values onto St r ings !&lt;br /&gt;}&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1330217516651230937-2189566717834371380?l=javaequation.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaequation.blogspot.com/feeds/2189566717834371380/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaequation.blogspot.com/2010/05/introduction-to-enums.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/2189566717834371380'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/2189566717834371380'/><link rel='alternate' type='text/html' href='http://javaequation.blogspot.com/2010/05/introduction-to-enums.html' title='Introduction to Enums'/><author><name>Raman Taneja</name><uri>http://www.blogger.com/profile/02519255746353479543</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-e1bep17DMpg/Tibl9hKq9hI/AAAAAAAAANk/wNZI30LoAhM/s220/RT.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-spjGRfDJCw4/TwWGvyo_hXI/AAAAAAAAAPM/yD2Ge8gLfds/s72-c/t3g6pb5j%2Bcopy.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1330217516651230937.post-8288369815348354713</id><published>2010-03-20T11:33:00.001-07:00</published><updated>2010-03-20T11:33:44.246-07:00</updated><title type='text'>Types</title><content type='html'>JAVA, like most programming languages classifies values and expressions into types.&lt;br /&gt;For e.g. String’s and int’s are types. A type basically specifies the allowed values&lt;br /&gt;and allowed operations on values of that type.&lt;br /&gt;Definition: A type is a set of values together with one or more operations&lt;br /&gt;that can be applied uniformly to all these values.&lt;br /&gt;A type system basically gives meaning to collections of bits. Because any value&lt;br /&gt;simply consists of a set of bits in a computer, the hardware makes no distinction&lt;br /&gt;between memory addresses, instruction code, characters, integers and floating-point&lt;br /&gt;numbers. Types inform programs and programmers how they should treat those bits.&lt;br /&gt;For example the integers are a type with values in the range −2, 147, 483, 648 to +&lt;br /&gt;2, 147, 483, 647 and various allowed operations that include addition, subtraction, modulus&lt;br /&gt;etc.&lt;br /&gt;The use of types by a programming language has several advantages:&lt;br /&gt;• Safety. Use of types may allow a compiler to detect meaningless or invalid code.&lt;br /&gt;For example, we can identify an expression ”Hello, World” / 3 as invalid because&lt;br /&gt;one cannot divide a string literal by an integer. Strong typing offers more safety.&lt;br /&gt;• Optimization. Static type-checking may provide useful information to a compiler.&lt;br /&gt;The compiler may then be able to generate more efficient code.&lt;br /&gt;• Documentation. Types can serve as a form of documentation, since they can&lt;br /&gt;illustrate the intent of the programmer. For instance, timestamps may be a&lt;br /&gt;subtype of integers – but if a programmer declares a method as returning a&lt;br /&gt;timestamp rather than merely an integer, this documents part of the meaning&lt;br /&gt;of the method.&lt;br /&gt;• Abstraction. Types allow programmers to think about programs at a higher&lt;br /&gt;level, not bothering with low-level implementation. For example, programmers&lt;br /&gt;can think of strings as values instead of as a mere array of bytes.&lt;br /&gt;There are fundamentally two types in JAVA: primitive types and objects types i.e.&lt;br /&gt;any variable you declare are either declared to be one of the primitive types or an&lt;br /&gt;object type. int, double and char are the built-in, primitive types in JAVA.&lt;br /&gt;The primitive types can be used in various combinations to create other, composite&lt;br /&gt;types. Every time we define a class, we are actually defining a new type. For example,&lt;br /&gt;the Student class defined above introduces a new type. We can now use this type like&lt;br /&gt;any other type: we can declare variables to be of this type and we can use it as a type&lt;br /&gt;for parameters of methods.&lt;br /&gt;Before a variable can be used, it must be declared. A declaration gives a variable&lt;br /&gt;a name, a type and an initial value for e.g. int x = 8 declares x to be of type int. All&lt;br /&gt;objects that we declare also have to be of a specified type—the type of an object is the&lt;br /&gt;class from which it is created. Thus, when we declare objects we state the type like&lt;br /&gt;so: Student st = new Student();. This statement declares the variable st to be of&lt;br /&gt;type Student. This statement creates a new object of the specified type and runs the&lt;br /&gt;Student constructor. The constructor’s job is to properly initialize the object.&lt;br /&gt;The String type is another example of an object type. Student and String are&lt;br /&gt;composite types and give us the same advantages as the built-in types. The ability to&lt;br /&gt;create our own types is a very powerful idea in modern languages.&lt;br /&gt;When declaring variables, we can assign initial values. If you do not specify initial&lt;br /&gt;values, the compiler automatically assigns one: Instance variables of numerical&lt;br /&gt;type (int, double, etc.) are automatically initialized to zero; boolean variables are&lt;br /&gt;initialized to false; and char variables, to the Unicode character with code number&lt;br /&gt;zero. The default initial value of object types is null.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1330217516651230937-8288369815348354713?l=javaequation.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaequation.blogspot.com/feeds/8288369815348354713/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaequation.blogspot.com/2010/03/types.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/8288369815348354713'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/8288369815348354713'/><link rel='alternate' type='text/html' href='http://javaequation.blogspot.com/2010/03/types.html' title='Types'/><author><name>Raman Taneja</name><uri>http://www.blogger.com/profile/02519255746353479543</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-e1bep17DMpg/Tibl9hKq9hI/AAAAAAAAANk/wNZI30LoAhM/s220/RT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1330217516651230937.post-2359081161348686582</id><published>2010-03-20T11:32:00.000-07:00</published><updated>2010-03-20T11:33:04.029-07:00</updated><title type='text'>Classes</title><content type='html'>In object-oriented software, it’s possible to have many objects of the same kind that&lt;br /&gt;share characteristics: rectangles, employee records, video clips, and so on. A class is&lt;br /&gt;a software blueprint for objects. A class is used to manufacture or create objects.&lt;br /&gt;The class declares the instance variables necessary to contain the state of every&lt;br /&gt;object. The class would also declare and provide implementations for the instance&lt;br /&gt;methods necessary to operate on the state of the object.&lt;br /&gt;Definition: A class is a blueprint that defines the variables and the methods&lt;br /&gt;common to all objects of a certain kind.&lt;br /&gt;&lt;br /&gt;After you’ve created the class, you can create any number of objects from that&lt;br /&gt;class.&lt;br /&gt;A class is a kind of factory for constructing objects. The non-static parts of the&lt;br /&gt;class specify, or describe, what variables and methods the objects will contain. This&lt;br /&gt;is part of the explanation of how objects differ from classes: Objects are created and&lt;br /&gt;destroyed as the program runs, and there can be many objects with the same structure,&lt;br /&gt;if they are created using the same class.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1330217516651230937-2359081161348686582?l=javaequation.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaequation.blogspot.com/feeds/2359081161348686582/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaequation.blogspot.com/2010/03/classes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/2359081161348686582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/2359081161348686582'/><link rel='alternate' type='text/html' href='http://javaequation.blogspot.com/2010/03/classes.html' title='Classes'/><author><name>Raman Taneja</name><uri>http://www.blogger.com/profile/02519255746353479543</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-e1bep17DMpg/Tibl9hKq9hI/AAAAAAAAANk/wNZI30LoAhM/s220/RT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1330217516651230937.post-809114239872909009</id><published>2010-03-20T11:31:00.000-07:00</published><updated>2010-03-20T11:32:19.930-07:00</updated><title type='text'>Messages</title><content type='html'>Software objects interact and communicate with each other by sending messages to&lt;br /&gt;each other. When object A wants object B to perform one of B’s methods, object A&lt;br /&gt;sends a message to object B&lt;br /&gt;There are three parts of a message: The three parts for the message&lt;br /&gt;System.out.println{‘‘Hello World’’}; are:&lt;br /&gt;• The object to which the message is addressed (System.out)&lt;br /&gt;• The name of the method to perform (println)&lt;br /&gt;• Any parameters needed by the method (“Hello World!”)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1330217516651230937-809114239872909009?l=javaequation.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaequation.blogspot.com/feeds/809114239872909009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaequation.blogspot.com/2010/03/messages.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/809114239872909009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/809114239872909009'/><link rel='alternate' type='text/html' href='http://javaequation.blogspot.com/2010/03/messages.html' title='Messages'/><author><name>Raman Taneja</name><uri>http://www.blogger.com/profile/02519255746353479543</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-e1bep17DMpg/Tibl9hKq9hI/AAAAAAAAANk/wNZI30LoAhM/s220/RT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1330217516651230937.post-2368884759196314351</id><published>2010-03-20T11:30:00.000-07:00</published><updated>2010-03-20T11:31:20.001-07:00</updated><title type='text'>Encapsulation</title><content type='html'>Object diagrams show that an object’s variables make up the center, or nucleus, of&lt;br /&gt;the object. Methods surround and hide the object’s nucleus from other objects in the&lt;br /&gt;program. Packaging an object’s variables within the protective custody of its methods&lt;br /&gt;is called encapsulation.&lt;br /&gt;&lt;br /&gt;Encapsulating related variables and methods into a neat software bundle is a&lt;br /&gt;simple yet powerful idea that provides two benefits to software developers:&lt;br /&gt;• Modularity: The source code for an object can be written and maintained independently&lt;br /&gt;of the source code for other objects. Also, an object can be easily&lt;br /&gt;passed around in the system. You can give your bicycle to someone else, and it&lt;br /&gt;will still work.&lt;br /&gt;• Information-hiding: An object has a public interface that other objects can use&lt;br /&gt;to communicate with it. The object can maintain private information and methods&lt;br /&gt;that can be changed at any time without affecting other objects that depend&lt;br /&gt;on it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1330217516651230937-2368884759196314351?l=javaequation.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaequation.blogspot.com/feeds/2368884759196314351/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaequation.blogspot.com/2010/03/encapsulation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/2368884759196314351'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/2368884759196314351'/><link rel='alternate' type='text/html' href='http://javaequation.blogspot.com/2010/03/encapsulation.html' title='Encapsulation'/><author><name>Raman Taneja</name><uri>http://www.blogger.com/profile/02519255746353479543</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-e1bep17DMpg/Tibl9hKq9hI/AAAAAAAAANk/wNZI30LoAhM/s220/RT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1330217516651230937.post-2641887396642798532</id><published>2010-03-20T11:29:00.000-07:00</published><updated>2010-03-20T11:30:32.426-07:00</updated><title type='text'>Fundamentals of Objects and Classes</title><content type='html'>We move now from the conceptual picture of objects and classes to a discussion of&lt;br /&gt;software classes and objects.4&lt;br /&gt;Objects are closely related to classes. A class can contain variables and methods.&lt;br /&gt;If an object is also a collection of variables and methods, how do they differ from&lt;br /&gt;classes?&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Objects and Classes&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Objects&lt;/span&gt;&lt;br /&gt;In object-oriented programming we create software objects that model real world objects.&lt;br /&gt;Software objects are modeled after real-world objects in that they too have&lt;br /&gt;state and behavior. A software object maintains its state in one or more variables. A&lt;br /&gt;variable is an item of data named by an identifier. A software object implements its&lt;br /&gt;behavior with methods. A method is a function associated with an object.&lt;br /&gt;Definition: An object is a software bundle of variables and related methods.&lt;br /&gt;An object is also known as an instance. An instance refers to a particular object.&lt;br /&gt;For e.g. Karuna’s bicycle is an instance of a bicycle—It refers to a particular bicycle.&lt;br /&gt;Sandile Zuma is an instance of a Student.&lt;br /&gt;The variables of an object are formally known as instance variables because they&lt;br /&gt;contain the state for a particular object or instance. In a running program, there&lt;br /&gt;may be many instances of an object. For e.g. there may be many Student objects.&lt;br /&gt;Each of these objects will have their own instance variables and each object may have&lt;br /&gt;different values stored in their instance variables. For e.g. each Student object will&lt;br /&gt;have a different number stored in its StudentNumber variable.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1330217516651230937-2641887396642798532?l=javaequation.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaequation.blogspot.com/feeds/2641887396642798532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaequation.blogspot.com/2010/03/fundamentals-of-objects-and-classes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/2641887396642798532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/2641887396642798532'/><link rel='alternate' type='text/html' href='http://javaequation.blogspot.com/2010/03/fundamentals-of-objects-and-classes.html' title='Fundamentals of Objects and Classes'/><author><name>Raman Taneja</name><uri>http://www.blogger.com/profile/02519255746353479543</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-e1bep17DMpg/Tibl9hKq9hI/AAAAAAAAANk/wNZI30LoAhM/s220/RT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1330217516651230937.post-6126948088974011470</id><published>2010-03-11T06:33:00.000-08:00</published><updated>2010-03-11T06:34:20.734-08:00</updated><title type='text'>Classes and Instances</title><content type='html'>The next important principle of object-oriented programming is&lt;br /&gt;All objects are instances of a class. The method invoked by an object in&lt;br /&gt;response to a message is determined by the class of the receiver. All objects&lt;br /&gt;of a given class use the same method in response to similar messages.&lt;br /&gt;Fred is an instance of a category or class of people i.e. Fred is an instance of a&lt;br /&gt;class of florists. The term florist represents a class or category of all florists. Fred is&lt;br /&gt;an object or instance of a class.&lt;br /&gt;We interact with instances of a class but the class determines the behaviour of instances.&lt;br /&gt;We can tell a lot about how Fred will behave by understanding how Florists&lt;br /&gt;behave. We know, for example, that Fred, like all florists can arrange and deliver&lt;br /&gt;flowers.&lt;br /&gt;In the real world there is this distinction between classes and objects. Real-world&lt;br /&gt;objects share two characteristics: They all have state and behavior. For example, dogs&lt;br /&gt;have state (name, color, breed, hungry) and behavior (barking, fetching, wagging tail).&lt;br /&gt;Students have state (name, student number, courses they are registered for, gender)&lt;br /&gt;and behavior (take tests, attend courses, write tests, party).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1330217516651230937-6126948088974011470?l=javaequation.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaequation.blogspot.com/feeds/6126948088974011470/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaequation.blogspot.com/2010/03/classes-and-instances.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/6126948088974011470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/6126948088974011470'/><link rel='alternate' type='text/html' href='http://javaequation.blogspot.com/2010/03/classes-and-instances.html' title='Classes and Instances'/><author><name>Raman Taneja</name><uri>http://www.blogger.com/profile/02519255746353479543</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-e1bep17DMpg/Tibl9hKq9hI/AAAAAAAAANk/wNZI30LoAhM/s220/RT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1330217516651230937.post-8432659846783150855</id><published>2010-03-11T06:31:00.000-08:00</published><updated>2010-03-11T06:33:24.467-08:00</updated><title type='text'>Messages and Responsibilities</title><content type='html'>Members of an object-oriented community make requests of each other. The next&lt;br /&gt;important principle explains the use of messages to initiate action:&lt;br /&gt;Action is initiated in object-oriented programming by the transmission of a&lt;br /&gt;message to an agent (an object) responsible for the actions. The message&lt;br /&gt;encodes the request for an action and is accompanied by any additional&lt;br /&gt;information (arguments/parameters) needed to carry out the request. The&lt;br /&gt;receiver is the object to whom the message is sent. If the receiver accepts the message, it accepts responsibility to carry out the indicated action. In&lt;br /&gt;response to a message, the receiver will perform some method to satisfy the&lt;br /&gt;request.&lt;br /&gt;&lt;br /&gt;There are some important issues to point out here:&lt;br /&gt;• The client sending the request need not know the means by which the request&lt;br /&gt;is carried out. In this we see the principle of information hiding.&lt;br /&gt;• Another principle implicit in message passing is the idea of finding someone else&lt;br /&gt;to do the work i.e. reusing components that may have been written by someone&lt;br /&gt;else.&lt;br /&gt;• The interpretation of the message is determined by the receiver and can vary&lt;br /&gt;with different receivers. For example, if you sent the message “deliver flowers”&lt;br /&gt;to a friend, she will probably have understood what was required and flowers&lt;br /&gt;would still have been delivered but the method she used would have been very&lt;br /&gt;different from that used by the florist.&lt;br /&gt;• In object-oriented programming, behaviour is described in terms of responsibilities.&lt;br /&gt;• Client’s requests for actions only indicates the desired outcome. The receivers&lt;br /&gt;are free to pursue any technique that achieves the desired outcomes.&lt;br /&gt;• Thinking in this way allows greater independence between objects.&lt;br /&gt;• Thus, objects have responsibilities that they are willing to fulfill on request. The&lt;br /&gt;collection of reponsibilities associated with an object is often called a protocol.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1330217516651230937-8432659846783150855?l=javaequation.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaequation.blogspot.com/feeds/8432659846783150855/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaequation.blogspot.com/2010/03/messages-and-responsibilities.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/8432659846783150855'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/8432659846783150855'/><link rel='alternate' type='text/html' href='http://javaequation.blogspot.com/2010/03/messages-and-responsibilities.html' title='Messages and Responsibilities'/><author><name>Raman Taneja</name><uri>http://www.blogger.com/profile/02519255746353479543</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-e1bep17DMpg/Tibl9hKq9hI/AAAAAAAAANk/wNZI30LoAhM/s220/RT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1330217516651230937.post-5459777641688248228</id><published>2010-03-07T00:58:00.000-08:00</published><updated>2010-03-07T00:59:25.486-08:00</updated><title type='text'>Object Orientation as a New Paradigm: The Big Picture</title><content type='html'>It is claimed that the problem-solving techniques used in object-oriented programming&lt;br /&gt;more closely models the way humans solve day-to-day problems.3&lt;br /&gt;So lets consider how we solve an everyday problem: Suppose you wanted to send&lt;br /&gt;flowers to a friend named Robin who lives in another city.To solve this problem you&lt;br /&gt;simply walk to your nearest florist run by, lets say, Fred. You tell Fred the kinds of&lt;br /&gt;flowers to send and the address to which they should be delivered. You can be assured&lt;br /&gt;that the flowers will be delivered.&lt;br /&gt;Now, lets examine the mechanisms used to solve your problem.&lt;br /&gt;• You first found an appropriate agent (Fred, in this case) and you passed to this&lt;br /&gt;agent a message containing a request.&lt;br /&gt;• It is the responsibility of Fred to satisfy the request.&lt;br /&gt;• There is some method (an algorithm or set of operations) used by Fred to do&lt;br /&gt;this.&lt;br /&gt;• You do not need to know the particular methods used to satisfy the request—&lt;br /&gt;such information is hidden from view.&lt;br /&gt;&lt;br /&gt;Off course, you do not want to know the details, but on investigation you may find&lt;br /&gt;that Fred delivered a slightly different message to another florist in the city where&lt;br /&gt;your friend Robin lives. That florist then passes another message to a subordinate&lt;br /&gt;who makes the floral arrangement.The flowers, along with yet another message, is&lt;br /&gt;passed onto a delivery person and so on. The florists also has interactions with wholesalers&lt;br /&gt;who, in turn, had interactions with flower growers and so on.&lt;br /&gt;This leads to our first conceptual picture of object-oriented programming:&lt;br /&gt;An object-oriented program is structured as community of interacting agents&lt;br /&gt;called objects. Each object has a role to play. Each object provides a service&lt;br /&gt;or performs an action that is used by other members of the community.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1330217516651230937-5459777641688248228?l=javaequation.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaequation.blogspot.com/feeds/5459777641688248228/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaequation.blogspot.com/2010/03/object-orientation-as-new-paradigm-big.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/5459777641688248228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/5459777641688248228'/><link rel='alternate' type='text/html' href='http://javaequation.blogspot.com/2010/03/object-orientation-as-new-paradigm-big.html' title='Object Orientation as a New Paradigm: The Big Picture'/><author><name>Raman Taneja</name><uri>http://www.blogger.com/profile/02519255746353479543</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-e1bep17DMpg/Tibl9hKq9hI/AAAAAAAAANk/wNZI30LoAhM/s220/RT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1330217516651230937.post-2940524489308837069</id><published>2010-03-06T11:14:00.000-08:00</published><updated>2010-03-06T11:15:11.296-08:00</updated><title type='text'>Logic Programming</title><content type='html'>Prolog (PROgramming in LOGic) 2 is the most widely available language in the logic&lt;br /&gt;programming paradigm. It is based on the mathematical ideas of relations and logical&lt;br /&gt;inference. Prolog is a declarative language meaning that rather than describing&lt;br /&gt;how to compute a solution, a program consists of a data base of facts and logical&lt;br /&gt;relationships (rules) which describe the relationships which hold for the given application.&lt;br /&gt;Rather then running a program to obtain a solution, the user asks a question.&lt;br /&gt;When asked a question, the run time system searches through the data base of facts&lt;br /&gt;and rules to determine (by logical deduction) the answer.&lt;br /&gt;Logic programming was an attempt to make a programming language that enabled&lt;br /&gt;the expression of logic instead of carefully specified instructions on the computer.&lt;br /&gt;In the logic programming language Prolog you supply a database of facts and&lt;br /&gt;rules; you can then perform queries on the database.&lt;br /&gt;This is also an example of a declarative style of programming where we state or&lt;br /&gt;define what we know.&lt;br /&gt;In the following example, we declare facts about some domain. We can then query&lt;br /&gt;these facts—we can ask, for example, are sally and tom siblings?&lt;br /&gt;sibling(X,Y) :− parent(Z,X), parent(Z,Y).&lt;br /&gt;parent(X,Y) :− father(X,Y).&lt;br /&gt;parent(X,Y) :− mother(X,Y).&lt;br /&gt;mother(trude, sally).&lt;br /&gt;father(tom, sally).&lt;br /&gt;father(tom, erica).&lt;br /&gt;father(mike, tom).&lt;br /&gt;The factorial function is written in prolog as two rules. Again, notice the declarative&lt;br /&gt;nature of the program.&lt;br /&gt;fac(0,1).&lt;br /&gt;fac(N,F) :− N &gt; 0,&lt;br /&gt;M is N − 1,&lt;br /&gt;fac(M,Fm),&lt;br /&gt;F is N   Fm.&lt;br /&gt;To summarize:&lt;br /&gt;&lt;br /&gt;• In procedural languages, everything is a procedure.&lt;br /&gt;• In functional languages, everything is a function.&lt;br /&gt;• In logic programming languages, everything is a logical expression (predicate).&lt;br /&gt;• In object-oriented languages, everything is an object.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1330217516651230937-2940524489308837069?l=javaequation.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaequation.blogspot.com/feeds/2940524489308837069/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaequation.blogspot.com/2010/03/logic-programming.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/2940524489308837069'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/2940524489308837069'/><link rel='alternate' type='text/html' href='http://javaequation.blogspot.com/2010/03/logic-programming.html' title='Logic Programming'/><author><name>Raman Taneja</name><uri>http://www.blogger.com/profile/02519255746353479543</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-e1bep17DMpg/Tibl9hKq9hI/AAAAAAAAANk/wNZI30LoAhM/s220/RT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1330217516651230937.post-7085625421751408509</id><published>2010-03-06T11:13:00.000-08:00</published><updated>2010-03-06T11:14:04.795-08:00</updated><title type='text'>Functional programming</title><content type='html'>Functional programming is a programming paradigm that treats computation as the&lt;br /&gt;evaluation of mathematical functions. Functional programming emphasizes the definition&lt;br /&gt;of functions, in contrast to procedural programming, which emphasizes the&lt;br /&gt;execution of sequential commands.&lt;br /&gt;The following is the factorial function written in a functional language called Lisp:&lt;br /&gt;(defun factorial (n)&lt;br /&gt;(if (&lt;= n 1) 1 (  n (factorial (− n 1))))&lt;br /&gt;)&lt;br /&gt;Notice that it defines the factorial function rather than give the steps to calculate it.&lt;br /&gt;The factorial of n is defined as 1 if n &lt;= 1 else it is n   factorial(n − 1)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1330217516651230937-7085625421751408509?l=javaequation.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaequation.blogspot.com/feeds/7085625421751408509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaequation.blogspot.com/2010/03/functional-programming.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/7085625421751408509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/7085625421751408509'/><link rel='alternate' type='text/html' href='http://javaequation.blogspot.com/2010/03/functional-programming.html' title='Functional programming'/><author><name>Raman Taneja</name><uri>http://www.blogger.com/profile/02519255746353479543</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-e1bep17DMpg/Tibl9hKq9hI/AAAAAAAAANk/wNZI30LoAhM/s220/RT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1330217516651230937.post-4620648367665066602</id><published>2010-03-06T11:12:00.000-08:00</published><updated>2010-03-06T11:13:14.305-08:00</updated><title type='text'>Programming Paradigms</title><content type='html'>Object-oriented programming is one of several programming paradigms. Other programming&lt;br /&gt;paradigms include the imperative programming paradigm (as exemplified&lt;br /&gt;by languages such as Pascal or C), the logic programming paradigm (Prolog), and the&lt;br /&gt;functional programming paradigm (exemplified by languages such as ML, Haskell or&lt;br /&gt;Lisp). Logic and functional languages are said to be declarative languages.&lt;br /&gt;We use the word paradigm to mean “any example or model”.&lt;br /&gt;This usage of the word was popularised by the science historian Thomas Kuhn.&lt;br /&gt;He used the term to describe a set of theories, standards and methods that together&lt;br /&gt;represent a way of organising knowledge—a way of viewing the world.&lt;br /&gt;Thus a programming paradigm is a&lt;br /&gt;. . . way of conceptualising what it means to perform computation and how&lt;br /&gt;tasks to be carried out on a computer should be structured and organised.&lt;br /&gt;We can distinguish between two types of programming languages: Imperative&lt;br /&gt;languages and declarative languages. Imperative knowledge describes how-to knowledge&lt;br /&gt;while declarative knowledge is what-is knowledge.&lt;br /&gt;A program is ”declarative” if it describes what something is like, rather than how&lt;br /&gt;to create it. This is a different approach from traditional imperative programming&lt;br /&gt;languages such as Fortran, and C, which require the programmer to specify an algorithm&lt;br /&gt;to be run. In short, imperative programs make the algorithm explicit and&lt;br /&gt;leave the goal implicit, while declarative programs make the goal explicit and leave&lt;br /&gt;the algorithm implicit.&lt;br /&gt;Imperative languages require you to write down a step-by-step recipe specifing&lt;br /&gt;how something is to be done. For example to calculate the factorial function in an&lt;br /&gt;imperative language we would write something like:&lt;br /&gt;public int factorial(int n) {&lt;br /&gt;int ans=1;&lt;br /&gt;for (int i = 2; i &lt;= n; i++){&lt;br /&gt;ans = ans   i;&lt;br /&gt;}&lt;br /&gt;return ans;&lt;br /&gt;}&lt;br /&gt;Here, we give a procedure (a set of steps) that when followed will produce the&lt;br /&gt;answer.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1330217516651230937-4620648367665066602?l=javaequation.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaequation.blogspot.com/feeds/4620648367665066602/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaequation.blogspot.com/2010/03/programming-paradigms.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/4620648367665066602'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/4620648367665066602'/><link rel='alternate' type='text/html' href='http://javaequation.blogspot.com/2010/03/programming-paradigms.html' title='Programming Paradigms'/><author><name>Raman Taneja</name><uri>http://www.blogger.com/profile/02519255746353479543</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-e1bep17DMpg/Tibl9hKq9hI/AAAAAAAAANk/wNZI30LoAhM/s220/RT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1330217516651230937.post-6637899368365278757</id><published>2010-03-06T11:11:00.000-08:00</published><updated>2010-03-06T11:12:09.428-08:00</updated><title type='text'>What is Object Oriented Programming?</title><content type='html'>OBJECT-ORIENTATION is a set of tools and methods that enable software engineers&lt;br /&gt;to build reliable, user friendly, maintainable, well documented, reusable software systems that fulfills the requirements of its users. It is claimed that object-orientation&lt;br /&gt;provides software developers with new mind tools to use in solving a wide variety of&lt;br /&gt;problems. Object-orientation provides a new view of computation. A software system&lt;br /&gt;is seen as a community of objects that cooperate with with each other by passing&lt;br /&gt;messages in solving a problem.&lt;br /&gt;An object-oriented programming laguage provides support for the following objectoriented&lt;br /&gt;concepts:&lt;br /&gt;Objects and Classes&lt;br /&gt;Inheritance&lt;br /&gt;Polymophism and Dynamic binding&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1330217516651230937-6637899368365278757?l=javaequation.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaequation.blogspot.com/feeds/6637899368365278757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaequation.blogspot.com/2010/03/what-is-object-oriented-programming.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/6637899368365278757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/6637899368365278757'/><link rel='alternate' type='text/html' href='http://javaequation.blogspot.com/2010/03/what-is-object-oriented-programming.html' title='What is Object Oriented Programming?'/><author><name>Raman Taneja</name><uri>http://www.blogger.com/profile/02519255746353479543</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-e1bep17DMpg/Tibl9hKq9hI/AAAAAAAAANk/wNZI30LoAhM/s220/RT.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1330217516651230937.post-1064163811014877051</id><published>2010-03-06T11:07:00.000-08:00</published><updated>2010-03-06T11:10:43.296-08:00</updated><title type='text'>OBJECT-ORIENTED PROGRAMMING</title><content type='html'>OBJECT-ORIENTED PROGRAMMING (OOP) represents an attempt to make programs&lt;br /&gt;more closely model the way people think about and deal with the world. In the older&lt;br /&gt;styles of programming, a programmer who is faced with some problem must identify&lt;br /&gt;a computing task that needs to be performed in order to solve the problem. Programming&lt;br /&gt;then consists of finding a sequence of instructions that will accomplish that&lt;br /&gt;task. But at the heart of object-oriented programming, instead of tasks we find objects&lt;br /&gt;– entities that have behaviors, that hold information, and that can interact with&lt;br /&gt;one another. Programming consists of designing a set of objects that model the problem&lt;br /&gt;at hand. Software objects in the program can represent real or abstract entities&lt;br /&gt;in the problem domain. This is supposed to make the design of the program more&lt;br /&gt;natural and hence easier to get right and easier to understand.&lt;br /&gt;An object-oriented programming language such as JAVA includes a number of&lt;br /&gt;features that make it very different from a standard language. In order to make&lt;br /&gt;effective use of those features, you have to “orient” your thinking correctly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1330217516651230937-1064163811014877051?l=javaequation.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaequation.blogspot.com/feeds/1064163811014877051/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaequation.blogspot.com/2010/03/object-oriented-programming.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/1064163811014877051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1330217516651230937/posts/default/1064163811014877051'/><link rel='alternate' type='text/html' href='http://javaequation.blogspot.com/2010/03/object-oriented-programming.html' title='OBJECT-ORIENTED PROGRAMMING'/><author><name>Raman Taneja</name><uri>http://www.blogger.com/profile/02519255746353479543</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-e1bep17DMpg/Tibl9hKq9hI/AAAAAAAAANk/wNZI30LoAhM/s220/RT.jpg'/></author><thr:total>0</thr:total></entry></feed>
