WEB开发网
开发学院WEB开发Jsp java接口用法学习---------------... 阅读

java接口用法学习----------------java菜鸟学飞第一步

 2008-01-05 09:07:22 来源:WEB开发网   
核心提示:jcreator PRo 2.5jdk 1.4.2===/* * @(#)ClsUsage.java 1.0 04/12/25 * * You can modify the template of this file in the * Directory ..\JCreator\Templates\Template_1

  jcreator PRo 2.5
jdk 1.4.2
===================================
/*
* @(#)ClsUsage.java 1.0 04/12/25
*
* You can modify the template of this file in the
* Directory ..\JCreator\Templates\Template_1\Project_Name.java
*
* You can also create your own project template by making a new
* folder in the directory ..\JCreator\Template\. Use the other
* templates as examples.
*
*/
package myprojects.clsusage;
import java.util.*;
class ClsUsage {

public ClsUsage() {

}

public static void main(String args[]) {
System.out.println("Starting ClsUsage...");
ISplitPage isp=new userPage(12);
isp.firstPage();
while(isp.haspages())
{
isp.nextPage();
}

}
}
interface ISplitPage
{
void firstPage();
void nextPage();
boolean hASPages();
}
class dateObj
{
private String name;
private int age;
private boolean sex;
private int id;
public static int personID;
static
{
personID=1000;
}
public dateObj(String na,int ag,boolean sx)
{
name=na;age=ag;sex=sx;
id=dateObj.personID++;
}
public dateObj(String na,int ag)
{
name=na;age=ag;sex=true;
id=dateObj.personID++;
}
public int getId()
{
return id;
}
public String getName()
{
return name;
}
public void setName(String na)
{
name=na;
}
public int getAge()
{
return age;
}
public void setAge(int dg)
{
age=dg;
}
public boolean isSex()
{
return this.sex;
}
public void setSex(boolean sx)
{
sex=sx;
}
public String toString()
{
return ""+id+"-"+name+"-"+age+"-"+sex;
}
}
class userPage implements ISplitPage
{
// which can be accessed with itself or son
//与自身或子类所在的包无关
protected int pageCount;
protected int pageIndex;
protected java.util.Vector list;
public userPage(int pages)
{
if(pages<=0)
this.pageCount=10;
int age=20;

Tags:java 接口 用法

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接