English 中文(简体)
转让的左侧必须是ec[闭门]的变差。
原标题:The left-hand side of an assignment must be a variable error in eclipse [closed]
  • 时间:2012-01-11 11:36:26
  •  标签:
  • java
  • android
public class CustomBlockFactory
{
private static final Logger logger = 
Logger.getLogger(TableListControllerFactory.class.getName());

public static AndroidTourController getController(TourControllerParameters 
paramTourControllerParameters, TourSequencer paramTourSequencer)
{
((CustomBlock)paramTourControllerParameters);
return new EnableTableController(paramTourControllerParameters, paramTourSequencer);
}
}

I m 在(CustomBlock)paramTourControllerParailes上出现错误;因为“任务左侧必须是变数”。

是否有任何人可以纠正这一错误?

预 收

最佳回答

它想像你试图将参数<代码>参数<>。 因此,你可以打电话到<代码>可调制的Controller。 然而,由于投放经营人not<>/em>改变了变量的静态类型,你的代码赢得了t工作。

相反,你可以产生一种新变量,即预期类型,并将投放者的结果分配给这一变量:

public static AndroidTourController getController(
    TourControllerParameters paramTourControllerParameters,
    TourSequencer paramTourSequencer)
{
    CustomBlock customBlock = (CustomBlock)paramTourControllerParameters;
    return new EnableTableController(customBlock, paramTourSequencer);
}

或者,你可以忽略临时变数,在一份声明中写出投稿和造价单:

return new EnableTableController(
    (CustomBlock)paramTourControllerParameters,
    paramTourSequencer);
问题回答

Because you re doing nothing with this code

((CustomBlock)paramTourControllerParameters);

你们是否希望这样做?

return new EnableTableController((CustomBlock) paramTourControllerParameters, paramTourSequencer);

((CustomBlock)paramTourControllerParameters); will cast paramTourControllerParameters into CustomBlock , so you need to store it into new variable like

CustomClock customClock = ((CustomBlock)paramTourControllerParameters);




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...