标题:新手请教.--cannot find symbol
只看楼主
xkrumeng
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2010-2-4
结帖率:100%
已结贴  问题点数:20 回复次数:3 
新手请教.--cannot find symbol
当我在编译的时候出现的一个问题.
E:\jpp>javac LotteryOdds.java
LotteryOdds.java:10: cannot find symbol
symbol  : method nextIn()
location: class java.util.Scanner
        int n = in.nextIn();
                  ^
1 error

这个应该怎么样解决啊?
我的环境变量设置为:
classPath
.;E:\java\JDK\lib\dt.jar;E:\java\JDK\lib\tools.jar;


程序源码为:

import java.util.*;

public class LotteryOdds
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);

        System.out.print("How many numbers do yow need to draw?");
        int n = in.nextIn();

        int lotteryOdds = 1;
        for(int i=1;i<=n;i++){
            lotteryOdds = lotteryOdds * (n-i+1)/i;
        }
        System.out.println("Your odds are 1 in "+lotteryOdds+" Good Luck!");
    }
}


[ 本帖最后由 xkrumeng 于 2010-8-17 11:56 编辑 ]
搜索更多相关主题的帖子: symbol cannot find 
2010-08-17 11:53
东方一帅
Rank: 2
等 级:论坛游民
帖 子:18
专家分:34
注 册:2010-7-23
得分:20 
import java.util.*;

public class LotteryOdds
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);

        System.out.print("How many numbers do yow need to draw?");
        int n = in.nextInt();//少了个"t"

        int lotteryOdds = 1;
        for(int i=1;i<=n;i++){
            lotteryOdds = lotteryOdds * (n-i+1)/i;
        }
        System.out.println("Your odds are 1 in "+lotteryOdds+" Good Luck!");
    }
}
2010-08-17 12:21
xkrumeng
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2010-2-4
得分:0 
谢谢!还真是没注意到.还以为是环境变量错了呢..呵呵
2010-08-17 12:25
毕业旅行
Rank: 4
等 级:业余侠客
威 望:1
帖 子:130
专家分:280
注 册:2010-7-7
得分:0 
额。。。这种问题JAVA里不用编译就会有红色小波浪线提示有问题的麽?
2010-08-17 22:53



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-315956-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.117824 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved