我是一个初学者,我很想学JAVA,请教:HelloWorld问题!!!
源程序://
public class HelloWorld {
public static void main(String args[]){
System.out.printIn("Hello world");
}
}
//
我是用记事本编写的,书入法是英文!(EN)
Win2000系统;
文件存在E:\test文件夹下"HelloWorld.java"
在CMD窗口运行时出现如下错误:E:\test>javac HelloWorld.java
//错误信息://
HelloWorld.java:3: cannot resolve symbol
symbol : method printIn (java.lang.String)
location: class java.io.PrintStream
System.out.printIn("Hello world");
^
1 error E:\test>
我是用记事本编写的,书入法是英文!(EN)
Win2000系统; 我下载的文件:
j2sdk_1_4_2_windows_i586.exe
我的JDK安装情况:
E:\j2sdk1.4.2//:我的环境配置如下:
JAVA_HOME:"E:\j2sdk1.4.2" PTTH: "%JAVA_HOME%\bin;" classpath:".;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar"另外的错误表现:
//:源码
import java.util.*;
public class Property
{
public static void main(String args[])
{
System.out.println(new Date( ));
Properties p=System.getProperties( );
p.list(System.out);
System.out.println("--- Memory Usage:");
Runtime rt=Runtime.getRuntime( );
System.out.println("Total Memory= "+ rt.totalMemory( )+" Free Memory = "+rt.freeMemory( ));
}
}
//:CMD窗口Microsoft Windows 2000 [Version 5.00.2195]
(C) 版权所有 1985-2000 Microsoft Corp.C:\>e:E:\>cd test"文件存在test下"
E:\test>javac Property.java
Property.java:2: illegal character: \12288
public class Property
^
Property.java:4: illegal character: \12288
public static void main(String args[])
^
Property.java:4: illegal character: \12288
public static void main(String args[])
^
Property.java:5: illegal character: \12288
{
^
Property.java:5: illegal character: \12288
{
^
Property.java:7: illegal character: \12288
Properties p=System.getProperties( );
^
Property.java:7: illegal character: \12288
Properties p=System.getProperties( );
^
Property.java:8: illegal character: \12288
p.list(System.out);
^
Property.java:8: illegal character: \12288
p.list(System.out);
^
Property.java:9: illegal character: \12288
System.out.println("--- Memory Usage:");
^
Property.java:9: illegal character: \12288
System.out.println("--- Memory Usage:");
^
Property.java:10: illegal character: \12288
Runtime rt=Runtime.getRuntime( );
^
Property.java:10: illegal character: \12288
Runtime rt=Runtime.getRuntime( );
^
Property.java:11: illegal character: \12288
System.out.println("Total Memory= "+ rt.totalMemory( )+" Free Memory = "+rt.
freeMemory( ));
^
Property.java:11: illegal character: \12288
System.out.println("Total Memory= "+ rt.totalMemory( )+" Free Memory = "+rt.
freeMemory( ));
^
Property.java:12: illegal character: \12288
}
^
Property.java:12: illegal character: \12288
}
^
Property.java:12: illegal character: \12288
}
^
Property.java:12: illegal character: \12288
}
^
Property.java:13: illegal character: \12288
}
^
Property.java:13: illegal character: \12288
}
^
Property.java:13: <identifier> expected
}
^
Property.java:13: illegal character: \12288
}
^
Property.java:13: illegal character: \12288
}
^
Property.java:14: illegal character: \12288
^
Property.java:14: illegal character: \12288
^
Property.java:16: 'class' or 'interface' expected
^
27 errorsE:\test>
前辈们给予指点,谢谢!一个渴望帮助的人!!!!
源程序://
public class HelloWorld {
public static void main(String args[]){
System.out.printIn("Hello world");
}
}
//
我是用记事本编写的,书入法是英文!(EN)
Win2000系统;
文件存在E:\test文件夹下"HelloWorld.java"
在CMD窗口运行时出现如下错误:E:\test>javac HelloWorld.java
//错误信息://
HelloWorld.java:3: cannot resolve symbol
symbol : method printIn (java.lang.String)
location: class java.io.PrintStream
System.out.printIn("Hello world");
^
1 error E:\test>
我是用记事本编写的,书入法是英文!(EN)
Win2000系统; 我下载的文件:
j2sdk_1_4_2_windows_i586.exe
我的JDK安装情况:
E:\j2sdk1.4.2//:我的环境配置如下:
JAVA_HOME:"E:\j2sdk1.4.2" PTTH: "%JAVA_HOME%\bin;" classpath:".;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar"另外的错误表现:
//:源码
import java.util.*;
public class Property
{
public static void main(String args[])
{
System.out.println(new Date( ));
Properties p=System.getProperties( );
p.list(System.out);
System.out.println("--- Memory Usage:");
Runtime rt=Runtime.getRuntime( );
System.out.println("Total Memory= "+ rt.totalMemory( )+" Free Memory = "+rt.freeMemory( ));
}
}
//:CMD窗口Microsoft Windows 2000 [Version 5.00.2195]
(C) 版权所有 1985-2000 Microsoft Corp.C:\>e:E:\>cd test"文件存在test下"
E:\test>javac Property.java
Property.java:2: illegal character: \12288
public class Property
^
Property.java:4: illegal character: \12288
public static void main(String args[])
^
Property.java:4: illegal character: \12288
public static void main(String args[])
^
Property.java:5: illegal character: \12288
{
^
Property.java:5: illegal character: \12288
{
^
Property.java:7: illegal character: \12288
Properties p=System.getProperties( );
^
Property.java:7: illegal character: \12288
Properties p=System.getProperties( );
^
Property.java:8: illegal character: \12288
p.list(System.out);
^
Property.java:8: illegal character: \12288
p.list(System.out);
^
Property.java:9: illegal character: \12288
System.out.println("--- Memory Usage:");
^
Property.java:9: illegal character: \12288
System.out.println("--- Memory Usage:");
^
Property.java:10: illegal character: \12288
Runtime rt=Runtime.getRuntime( );
^
Property.java:10: illegal character: \12288
Runtime rt=Runtime.getRuntime( );
^
Property.java:11: illegal character: \12288
System.out.println("Total Memory= "+ rt.totalMemory( )+" Free Memory = "+rt.
freeMemory( ));
^
Property.java:11: illegal character: \12288
System.out.println("Total Memory= "+ rt.totalMemory( )+" Free Memory = "+rt.
freeMemory( ));
^
Property.java:12: illegal character: \12288
}
^
Property.java:12: illegal character: \12288
}
^
Property.java:12: illegal character: \12288
}
^
Property.java:12: illegal character: \12288
}
^
Property.java:13: illegal character: \12288
}
^
Property.java:13: illegal character: \12288
}
^
Property.java:13: <identifier> expected
}
^
Property.java:13: illegal character: \12288
}
^
Property.java:13: illegal character: \12288
}
^
Property.java:14: illegal character: \12288
^
Property.java:14: illegal character: \12288
^
Property.java:16: 'class' or 'interface' expected
^
27 errorsE:\test>
前辈们给予指点,谢谢!一个渴望帮助的人!!!!
是println第二个问题你的编码有问题,修改后如下
import java.util.*;
public class Property
{
public static void main(String args[])
{
System.out.println(new Date());
Properties p=System.getProperties();
p.list(System.out);
System.out.println("--- Memory Usage:");
Runtime rt=Runtime.getRuntime();
System.out.println("Total Memory= "+ rt.totalMemory()+" Free Memory = "+rt.freeMemory());
}
}
不会有编译问题了
HelloWorld.java:3: cannot resolve symbol
symbol : method printIn (java.lang.String)
location: class java.io.PrintStream
System.out.printIn("Hello world");
^
1 error1.System.out.println("Hello world"); 该方法是ln不是In
C:\Documents and Settings\Administrator>cd e:\test
C:\Documents and Settings\Administrator>e:
E:\test>javac Property.javaE:\test>java Property
Fri Dec 23 15:45:27 CST 2005
-- listing properties --
java.runtime.name=Java(TM) 2 Runtime Environment, Stand...
sun.boot.library.path=C:\Program Files\Oracle\jre\1.3.1\bin
java.vm.version=1.3.1_01
java.vm.vendor=Sun Microsystems Inc.
java.vendor.url=http://java.sun.com/
path.separator=;
java.vm.name=Java HotSpot(TM) Client VM
file.encoding.pkg=sun.io
java.vm.specification.name=Java Virtual Machine Specification
user.dir=E:\test
java.runtime.version=1.3.1_01
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
os.arch=x86
java.io.tmpdir=C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\
line.separator=java.vm.specification.vendor=Sun Microsystems Inc.
java.awt.fonts=
os.name=Windows 2000
java.library.path=C:\Program Files\Oracle\jre\1.3.1\bin...
java.specification.name=Java Platform API Specification
java.class.version=47.0
os.version=5.2
user.home=C:\Documents and Settings\Administrator
user.timezone=Asia/Shanghai
java.awt.printerjob=sun.awt.windows.WPrinterJob
file.encoding=GBK
java.specification.version=1.3
user.name=Administrator
java.class.path=.
java.vm.specification.version=1.0
java.home=C:\Program Files\Oracle\jre\1.3.1
user.language=zh
java.specification.vendor=Sun Microsystems Inc.
awt.toolkit=sun.awt.windows.WToolkit
java.vm.info=mixed mode
java.version=1.3.1_01
java.ext.dirs=C:\Program Files\Oracle\jre\1.3.1\lib...
sun.boot.class.path=C:\Program Files\Oracle\jre\1.3.1\lib...
java.vendor=Sun Microsystems Inc.
file.separator=\
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport...
sun.cpu.endian=little
sun.io.unicode.encoding=UnicodeLittle
user.region=CN
sun.cpu.isalist=pentium i486 i386
--- Memory Usage:
Total Memory= 2031616 Free Memory = 1604352