Responsibility, Methods, Messages In JAVA

 Responsibility

        primary motivation is the need for a platform-independent (that is, architecture- neutral) language that could be used to create software to be embedded in various consumer electronic devices, such as microwave ovens and remote controls. 

Objects with clear responsibilities. 

Each class should have a clear responsibility. 

If you can't state the purpose of a class in a single, clear sentence, then perhaps your class structure needs some thought. 


Messages

• We all like to use programs that let us know what's going on. Programs that keep us informed often do so by displaying status and error messages.

• These messages need to be translated so they can be understood by end users around the world.

• The Section discusses translatable text messages. Usually, you're done after you move a message String into a Resource Bundle.

• If you've embedded variable data in a message, you'll have to take some extra steps to prepare it for translation.


Methods

• A method is a group of instructions that is given a name and can be called up at any point in a program simply by quoting that name.

• Drawing a Triangle require draw of three straight lines. This instruction three times to draw a simple triangle.

• We can define a method to call this instruction three times and draw the triangle(i.e. create a method draw Line() to draw lines and this method is called repeatedly to achieve the needed task)

• The idea of methods appears in all programming languages, although sometimes it goes under the name functions and sometimes under the name procedures.

• The name methods is a throw-back to the language C++, from which Java was developed.

• In C++, there is an object called a class which can contain methods. However, everything in Java is enclosed within a class .so the functions within it are called methods


Post a Comment (0)
Previous Post Next Post