by Dinesh Thakur Category: Introduction to Java

A Java class is a group of Java objects all of which have the same or similar properties in common. Classes are logical entities and can never be physical. In a class  you may find:  
● Fields  
● Methods  
● Constructors  
● Blocks  
● Nested classes and an interface

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();
                    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

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.