帮忙写一个简单的java程序

来源:百度知道 编辑:UC知道 时间:2024/05/26 04:13:56
最简单的就可以,满意的,速度的加分
程序帮忙做一个可以么

import java.io.*; //类似C里#include<>
class Hello
{
public static void main(String[] args) //类似C里的main()
{
System.out.println("Java");
}
}

public class HelloWorld
{
String str;
public HelloWorld(String str){
this.str=str;
}
public void show(){
System.out.println(this.str);
}
public static void main(String[] args)
{
HelloWorld hw=new HelloWorld("hello world");
hw.show();
}
}

public class Hello
{
public static void main(String[] args)
{
System.out.println("hello world!");
}
}

呵呵 楼主 我也是初学 有什么不对的地方多多指教

一般新学一门语言的时候就是输出一个“HelloWorld”是最简单的例子

public class HelloWorld {// 定义类名为HelloWorld

public static void main(String[] args) {// 主方法或叫主函数
System.out.println("HelloWorld");// 输出语句 "HelloWorld"

}
<