將上述生成的Hello.java和HelloWorld框架代碼(指:代碼結構),在Jbuilder環境下填寫必要的代碼:可以得到Hello.java
//Source file: C:\\Hello\\src\\Hello.java
public interface Hello
{
public final static String hi="你好";
/**
* @roseuid 3E9932680328
*/
public void say();
}
HelloWorld的代碼為:
//Source file: C:\\Hello\\src\\HelloWorld.java
import java.io.*;
public class HelloWorld implements Hello
{
private String name=null;
/**
* @roseuid 3E9937D302C8
*/
public HelloWorld()
{
System.out.println("請輸入您想問候的名字(按回車結束):");
try {
DataInputStream da = new DataInputStream(System.in);
name = new String(da.readLine().getBytes("ISO8859-1"));
}
catch (IOException ex) { }
}
/**
* @roseuid 3E9937BC0008
*/
public static void main(String [] args) {
HelloWorld hh=new HelloWorld();
hh.say();
}
/**
* @roseuid 3E9937D30318
*/
public void say()
{
System.out.println(this.hi+name);
}
}
文章來源于領測軟件測試網 http://www.kjueaiud.com/