如何使变量值可用于另一个类?

时间:2015-03-12 15:19:36

标签: java inheritance constructor

我已经尝试了很多这方面的事情,包括这里类似问题的解决方案,但仍然没有快乐。

我正在使用扫描程序获取两个变量patientNamepatientAddress的值,然后我希望将这些值转移到另一个类,但是当我尝试它时,值会以{ {1}}。这是代码。

null

1 个答案:

答案 0 :(得分:2)

我估计可变范围。

改变这个:

String patientAddress = patientScanner.nextLine();

到这个

patientAddress = patientScanner.nextLine();