Latest Videos
Ruby Meet Up 8/13/09: Ruby Files on Google App Engine
Ruby Meet Up 8/13/09: Ruby Files on Google App Engine

Presented at the Ruby Meet Up by John Woodell and…

Videos | Oct 24, 2011
Ruby Meet Up 8/13/09: Interfaces and the Future of Ruby
Ruby Meet Up 8/13/09: Interfaces and the Future of Ruby

Presented at the Ruby Meet Up by Yehuda Katz. Yehuda…

Videos | Oct 24, 2011
Picasa Web Albums Data API
Picasa Web Albums Data API

Sven Mawson gives an overview of the Picasa Web Albums…

API | Mar 18, 2011
Google App Engine - Early Look at Java Language Support
Google App Engine - Early Look at Java Language Support

This video introduces the latest features of App Engine, including…

Videos | Mar 17, 2011
Show More
Latest Freebies
PHP Contact Form Script

Here is a nice contact form for your website. This…

Free Forms | Dec 09, 2010
LightForm ::: Free Ajax/PHP Contact Form
LightForm ::: Free Ajax/PHP Contact Form

LightForm is a free Ajax/PHP contact form. It combines FormCheck2…

Free Forms | Dec 09, 2010
LightForm ported to WordPress v2.5.1
LightForm ported to WordPress v2.5.1

LightForm is now a WordPress plugin (only works with latest…

Free Forms | Dec 09, 2010
Sliding Login Panel with Mootools 1.2
Sliding Login Panel with Mootools 1.2

Some of you were wondering what script I used to…

Free Forms | Dec 09, 2010
Show More
You are here > Home > Java SE
Java Class Example
Author: Cyberical Views: 311 Posted On: Apr 27, 2009
/*
Java Class example.
This Java class example describes how class is defined and being used in Java language.
 
Syntax of defining java class is,
<modifier> class <class-name>{
// members and methods
}
*/
  public class JavaClassExample{ /*
Syntax of defining memebers of the java class is,
<modifier> type <name>;
*/
private String name; /*
Syntax of defining methods of the java class is,
<modifier> <return-type> methodName(<optional-parameter-list>) <exception-list>{
...
}
*/
public void setName(String n){ //set passed parameter as name name = n; } public String getName(){ //return the set name return name; } //main method will be called first when program is executed public static void main(String args[]){ /*
Syntax of java object creation is,
<class-name> object-name = new <class-constructor>;
*/
JavaClassExample javaClassExample = new JavaClassExample(); //set name member of this object javaClassExample.setName("Visitor"); // print the name System.out.println("Hello " + javaClassExample.getName()); } }   /*
OUTPUT of the above given Java Class Example would be :
Hello Visitor
*/