令牌“无效字符"的语法错误,请删除此令牌 [英] Syntax error on token "Invalid Character", delete this token

查看:103
本文介绍了令牌“无效字符"的语法错误,请删除此令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定为什么会出现此错误.大括号似乎是正确的.另一件事是,该程序在Windows-eclipse中可用,但在Mac的eclipse中不可用.可能是什么原因?

I am not sure why is it giving this error. Braces seem to be right. Another thing is that the same program works in Windows-eclipse but not in eclipse for Mac. What could be the reason?

import java.util.Vector;

public class Debug 
{
    private int something = 0;
    private Vector list = new Vector();

    public void firstMethod()
    {
        thirdMethod(something);
        something = something + 1;
    }
    public void secondMethod()
    {
        thirdMethod(something);
        something = something + 2;
    }
    public void thirdMethod(int value)
    {
        something = something + value;
    }

    public static void main(String[] args)
    {
        Debug debug = new Debug();
        debug.firstMethod();
        debug.secondMethod();
    }
}

推荐答案

嗯,好吧-它可能是文件末尾的Control-Z或其他不可打印的字符,在Windows中会被忽略,但在Mac上不会被忽略.您已将源从Windows复制到Mac.删除最后几个字符,然后重新输入-我认为它将消失.不过,我不使用Mac-我只是在猜测.

Ah, ok - it's probably a control-Z or other unprintable character at the end of the file that is ignored in Windows but not on the Mac. You copied the source from Windows to the Mac. Delete the last few characters and re-enter them - I think it will go away. I don't do Mac, though - I'm just guessing.

这篇关于令牌“无效字符"的语法错误,请删除此令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆