我在试着编程,很简单的取随机数,可就这样也不对,我不知道哪里错了,编译时没问题,而且在Eclipse环境下运行JSimpleBug的例程也没出错,可为什么我这个简单的试验程序却出错了呢?帮帮忙吧。在Eclipse环境下。
% M8 }2 p% s, @! i3 T' Simport swarm.Globals;
( S4 G) m3 |% }" N- j2 M2 ]. ?9 S7 t7 j* A3 L9 I3 K; a+ n
public class test {
7 d2 F% \8 a* A4 Y: U$ v# S7 Q /**9 D. \3 x) R1 `& `8 T* B6 `" v
* @param args" _- B( R) K, ~3 N$ A/ i
*/
- |9 u9 H8 b R5 r/ H. Z public static void main(String[] args) {$ g' A8 J* W, Q9 @; w
. R) G/ I! _3 ^6 Y" M" s int y=(int)(10*Math.random());+ i+ y# @5 U* V8 E
System.out.println("result is "+y);
9 W* S+ X) O! Y0 e. c: v$ w/ u* T! ~
* k! U3 N h8 B double z=Globals.env.uniformDblRand.getDoubleWithMin$withMax(0.0, 1.0);* W" H! ^1 s$ j8 |* i) s+ p
System.out.print(z+" re");
7 j8 ^. I F9 x/ Y# T) j }
. U6 S. r9 N3 G% Z: B5 `# `}
* T; ?% ~( `2 L6 n, U+ ~- A: F
! }: w- G, K4 A6 z# e; w结果是:
4 p$ `6 t+ k6 v* {4 [, i3 lresult is 2
6 D5 T" F" P b. f#
1 a; U1 G' v1 Y/ @0 ^# \7 I) `' F9 r# An unexpected error has been detected by Java Runtime Environment:
% a1 r i9 i% y+ v: h7 U! T#, j% B3 ~# T2 {! U) a
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x100b8305, pid=1064, tid=1068
/ z9 X$ [. T' X. z$ n#
1 R# O9 g: o4 i7 |2 r- n2 k3 ]& l# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode, sharing), N* A$ I9 n% x: O. ^
# Problematic frame:
% _1 k L( t$ m5 Y# M# C [javaswarm.dll+0xb8305]% c0 h" }* K1 g* N D. B
#+ M8 a2 A( i. n' ]
# An error report file with more information is saved as hs_err_pid1064.log |