In this article, we will be looking how to declare methods in Java.
Lets look to use of declaringin a java class.
package com.p1;
public class CL_servers
{
String hostname;
public CL_servers()
{
hostname = "unknown";
}
public void addServer()
{
System.out.println("server has been added to DB");
}
}
Lets see it in Java class example.
In above example, in our above class, we called our method "addServer" from our console application main class.