Turn Desktop View Off
by Dinesh Thakur

In the Following Java Example, shows how to Create a Class Using Java Example. in this example we show that Syntax of java object creation is <className> objectName = new <classConstructor>; and the Syntax of defining methods of the java class is <modifier> <return-type> method-Name(<optionalParameterList>) <ExceptionList>

Here is the Java Example for the program JavaClassExampleCode : 

public class JavaClassExampleCode

{
                     public static void main(String []args)
          {
                    JavaClassExampleCode JavaExample = new JavaClassExampleCode();
                    JavaExample.setName("Java");
                    System.out.println("Hello " + JavaExample.getName());
           }
                       private String Name;
                       public void setName(String name)
                 {
                       Name = name; //set Parameter to name variable
                 }
                       public String getName()
                      {
                           return Name; //return the setName
                      }
}

java class example code