正确答案: 正确答案:
对于以下源代码,请问:在不修改任何代码的情况下,
(1)在jdk中应该怎样命名?
(2)编译命令怎么写?
(3)运行命令怎么写?public class A
{
void f()
{
System.out.println("I love Java as much as I love coffee.");
}
}
class Hello
{
public static void main(String args[])
{
System.out.println("Hello, it is very glad to learn Java.");
A a=new A();
a.f();
}
}
(1)A.java
(2)javac A.java
(3)java Hello
对于以下源代码,在eclipse中,应该修改哪些内容,才能正确命名?public class A
{
void f()
{
System.out.println("I love Java as much as I love coffee.");
}
}
class Hello
{
public static void main(String args[])
{
System.out.println("Hello, it is very glad to learn Java.");
A a=new A();
a.f();
}
}
将代码改为:
class A
{
void f()
{
System.out.println("I love Java as much as I love coffee.");
}
}
public class Hello
{
public static void main(String args[])
{
System.out.println("Hello, it is very glad to learn Java.");
A a=new A();
a.f();
}
}