2013-10-06 43 views
-4

这里是我的错误: “异常线程‘主’了java.lang.RuntimeException:不可编译的源代码 - 类项目构造theController * * .theController不能被应用到给定的类型;Java的编译错误,请帮帮忙,我吮吸的Java

需要:java.lang.String中

发现:整数

原因:实际参数INT不能在项目通过方法调用转换 转换为java.lang.String * ** .Main.main(Main.java:23)“

我知道它告诉我问题是什么,但我该如何解决?

这里是我的“主”我的代码,

public class Main { 

/** 
* @param args the command line arguments 
*/ 
public static void main(String[] args) throws IOException 
{ 


    readFile statesReadfile = new readFile(); 
    statesReadfile.loadData("States2.txt"); 
    theController statesQueues = new theController(statesReadfile.getNumStates()); 
    StatesStack myStatesStack = new StatesStack(statesReadfile.getNumStates()); 

和这里就是我想这不会导致匹配我有一个错误那里,

public class theController 
{ 
public Queues pq1; 
public Queues pq3; 
public Queues pq5; 
public Queues pq6; 
private StatesStack stateArray; 
private readFile statesReadfile; 
/* 
* 
*/ 
public theController(String filename) throws IOException 
{ 
    statesReadfile = new readFile(); 
    stateArray = statesReadfile.loadData(filename); 

    pq1 = new Queues(6); 
    pq3 = new Queues(12); 
    pq5 = new Queues(6); 
    pq6 = new Queues(12); 
    }// end of 

任何有用的建议将不胜感激,谢谢。

(噢,我有,如果需要更多的代码)

+4

永远不要运行没有编译的代码。 –

回答

0

要传递到theController构造函数的参数是一个int,但它应该是一个字符串在该行theController statesQueues = new theController(statesReadfile.getNumStates());

getNumStates()回报的多少状态。

+0

@hazerthanks我看到需要发生的事情,我只是不知道该怎么做,每当我改变一件事情时,其他事情都会变成红色,但是感谢任何方式的输入。 – user1830008