9/24/2008

How To Write Java Code

Generally, java class format seems below :
import package;
class classsname{

method1();
method2();
-
-
method-n;
}

more specific seems below :

import package;
class name{
objects declaration;
constructor(){

object setting;
}
methode main(){

call class();
}
}

here is the sample :

import javax.swing.*;
class sample extends JFrame{
sample(){
super("Sample");
show();
setSize(200,100);
setLocation(100,100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args){
new sample();
}
}