. . .

How to make a new object in java?

software object in java

Each software objects in java contain data and the functions that operate on the data. Objects can interact without having to know details of each other’s data or functions. It is sufficient to know the type of message accepted and the type of response returned by the software object in java.

Software objects are modeled after real-world objects. A software object maintains its state in one or more variables. A variable is an item of data named by an identifier. A software object reflects its behavior with the help of method implementation. A method is an implementation way of a function associated with an object.

A software objects in java is a software bundle of variables and related methods. You can represent real-world objects by using software objects. For example, you might have observed that real-world dogs as software objects in an animation program or a real-world airplane as a software object in the simulator program that controls an electronic airplane. You can also use software objects to model abstract concepts.

For example, in the banking system, customer object may send a message named as check balance to the account object to get the response, i.e. bank balance. An Object-Oriented system can be considered as a network of cooperating objects which interact by sending messages to each other.

software object in java

Now, We will try to make an object with the help of a program software objects:

public class One{
 String str; 
 void setStr(String s)
 String getStr()
	 return str;

class OneMain{
	public static void main(String []args)
		One one=new One();    //  create a oblect of One class
		String s=  one.getStr();
Please share the article

Leave a Reply

Your email address will not be published. Required fields are marked *

12 + 2 =