它在我的桌面上,如果你能一步一步告诉我如何运行这个程序。我知道javac编译程序。
public class SimpleProgram {
public static void main(String[] args){
System.out.println("A proverb");
String Proverb = "Practice makes perfect!";
System.out.println("Proverb");
int CharacterCount = Proverb.length();
Syetem.out.println("The Proverb has "+CharacterCount + "Characters");
}
}
答案 0 :(得分:1)
在命令提示符下,您可以使用Java命令运行您的类,并按照以下确切语法进行操作。
C:> java SimpleProgram
答案 1 :(得分:1)
答案 2 :(得分:1)
您发布的程序将不编译。这是以下版本:
public class SimpleProgram {
public static void main( String[] args ) {
System.out.println( "A proverb:" );
String proverb = "Practice makes perfect!";
System.out.println( "Proverb" );
int characterCount = proverb.length();
System.out.println( "The Proverb has " + characterCount + " Characters" );
}
}
您可以编译它并运行:
$ javac SimpleProgram.java
$ java SimpleProgram
A proverb:
Proverb
The Proverb has 23 Characters
答案 3 :(得分:1)
编译do java SimpleProgram
如果你不想这样做来回Textpad!
答案 4 :(得分:1)