将上述生成的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);
}
}
文章来源于领测软件测试网 https://www.ltesting.net/