Design Pattern and Object oriented Data Analaysis

Writing here to clearing engineering concept of a software for future reference.

Example for Class, Constructors and Methods:

Main.java

public static void main(String[] args)
{
User user=new User("Zaki",30);
//user.name="Zaki";

//System.out.println(user.name);
user.sayHello();
}

User.java

public class User{
	//defining the attribute
	public String name;
		
	//constructor creation
	public User(String name, int age){
		this.name=name;
	}
	
	//method creation
	public void sayHello{
		System.out.println("This is "+name);
	}
	
	//a interface is a contract a capability that a class should provide
//interface we can build loose coupled calculator

}

Interface Example

 

 

 

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published.